Permalink
Browse files

Better detection of presence in git repository

The return code from git rev-parse is a better indication of the user's
presence in a git repository. If the repos is a fresh init, git
rev-parse produces no output but has a return value of 0
  • Loading branch information...
Gabriel Filion
Gabriel Filion committed Feb 14, 2010
1 parent b7c53d1 commit 7cf4d2497373cde40565a58e691eb3d0d9711c7e
Showing with 2 additions and 1 deletion.
  1. +2 −1 git-bzr
View
@@ -238,7 +238,8 @@ function gitbzr_run() {
args="$@"
if [ "x$cmd" != "xhelp" ]; then
if [ -n "$(git rev-parse)" ] ; then
git rev-parse 1>/dev/null 2>&1
if [ $? -ne 0 ] ; then
perror "Must be inside a git repository to work"
exit 1
fi

0 comments on commit 7cf4d24

Please sign in to comment.