mixu/gr

gr discover <path> should expand discovered repos to full paths

Closed this issue · 5 comments

Running discovery with a path, such gr discover . creates a config file with relative paths in it. This is not useful unless gr is run in the same directory. The program should convert the path to full paths starting with / or ~ automatically so that discovered repos can be referenced from anywhere.

Example:

> gr discover .
# Found the following directories with `.git` directories.
...
play/a
play/b

Better would be:

> gr discover .
# Found the following directories with `.git` directories.
...
~/src/play/a
~/src/play/b

A workaround is to use gr discover pwd``.

This behavior was reproduced on gr version 0.5.0 and OS X 10.11.3.

I should have time to take a look at and fix this later tonight. Possibly even later today depending on how the day goes.

I won't have time until later, but it looks like one potential fix might be to convert the discovered git paths from relative paths to absolute paths after path normalization (line 177 of tag.js in 0234887). I'm thinking it might it be safe to do that with path.resolve(dir)?

Yeah, I was looking at the source to see where this might go and tracked down that same part of tag.js.

I submitted a PR for this fix. My first time doing that on github so please let me know if I've messed up in any way.

mixu commented

Thanks for the fix! closing this issue.