From: Junio C Hamano Date: Thu, 1 Sep 2005 00:13:48 +0000 (-0700) Subject: Fix git-status when HEAD is invalid. X-Git-Tag: v0.99.6~34 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7e011c40bc6c7dbd48b033fb16c861b1166f808c;p=git.git Fix git-status when HEAD is invalid. It tried to do git-diff-cache against HEAD, of course. Signed-off-by: Junio C Hamano --- diff --git a/git-status-script b/git-status-script index 1696f23e0..2b029545d 100755 --- a/git-status-script +++ b/git-status-script @@ -39,11 +39,23 @@ esac git-update-cache --refresh >/dev/null 2>&1 -git-diff-cache -M --cached HEAD | -sed 's/^://' | -report "Updated but not checked in" "will commit" +if test -f "$GIT_DIR/HEAD" +then + git-diff-cache -M --cached HEAD | + sed 's/^://' | + report "Updated but not checked in" "will commit" -committable="$?" + committable="$?" +else + echo '# +# Initial commit +#' + git-ls-files | + sed 's/^/o o o o A /' | + report "Updated but not checked in" "will commit" + + committable="$?" +fi git-diff-files | sed 's/^://' |