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="$?"
+else
+ echo '#
+# Initial commit
+#'
+ git-ls-files |
+ sed 's/^/o o o o A /' |
+ report "Updated but not checked in" "will commit"
-committable="$?"
+ committable="$?"
+fi
git-diff-files |
sed 's/^://' |
#'
fi
-if [ "$committable" == "0" ]
-then
+case "$committable" in
+0)
echo "nothing to commit"
exit 1
-fi
+esac
exit 0