Fails from within submodules (+solution)
MatmaRex opened this issue · comments
gitcoach and gitlearn currently expect the .git directory to live in <root>/.git
, but this is not always the case – for example, repos created as submodules have their .git directories in <parent_root>/.git/modules/<repo_name>
, and only have a .git file containing info about the real location. This makes gitlearn fail in funny ways.
You can use git rev-parse --git-dir
to get the path to the .git directory, and no, I don't know why rev-parse does this either. (The docs state it's relative to current directory, but for me it sometimes turns out to be absolute.) I'd implement it myself, but I'd have to understand the source code first, and I haven't gotten around to it yet :) – it looks like the change might be necessary in a few places.
I used this approach in the current version -- thanks!