Closed bimlas closed 6 years ago
Finally, it works as expected.
An example output (reformatted to be more readable):
$ gr git status --short --branch
Skipped ~/not-a-git-repo as it is not a Git repository.
in ~/git-repo
## master...origin/master
in ~/git-repo/submodule
## master...origin/master
Skipped ~/git-repo/more/than as it is not the root of Git repository or submodule.
in ~/git-repo/more/than/one/level/submodule
## master...origin/master
@mixu, please review and merge if you agree.
thanks! sorry for the long delay in merging!
published on npm as v0.5.5
Instead of check the existness of
.git
directory, usegit rev-parse
to check thatreq.path
is inThe old method didn't worked with submodules more than one level deep in the repo. Besides this if the $GIT_DIR differs from
.git
(cannot find a real life example), then the old method fails to work.Related to #54
It's using
git rev-parse --show-prefix
which drops error if executed outside of Git repository; prints the prefix ("the current directory relative to Git root") if executed from a subdirectory. The behaviour if equal for Git repo and submodule too.Curently it's not working because I can't return true/false from exec, so I need help in making it usable.
Please be patient, it's my very first Node.js code and I'm beginner in Javascript too.