Open marcinant opened 10 years ago
Yeah, that's probably better. We can also look at the exit code of the command. For example:
$ mkdir is-a-git-repo
$ cd is-a-git-repo
$ git rev-parse --is-inside-work-treex
fatal: Not a git repository (or any of the parent directories): .git
$ echo $?
128
$ git init
Initialized empty Git repository in /Users/rejeep/tmp/is-a-git-repo/.git/
$ git rev-parse --is-inside-work-treex
--is-inside-work-treex
$ echo $?
0
Just an idea and piece of
oneliner
I found 5 minutes ago:Returns true if dir is under git version control and false if it's not. IMHO this should be used by
git-repo?
instead of current solution.