Code

Merge branch 'maint' of git://linux-nfs.org/~bfields/git into maint
[git.git] / git-commit.sh
index ec506d956fa2858897c53b35d28db8083b7fdcec..cad16a5e868730dd56f79baf711aed138d7cafe1 100755 (executable)
@@ -318,6 +318,10 @@ esac
 
 case "$all,$also" in
 t,)
+       if test ! -f "$THIS_INDEX"
+       then
+               die 'nothing to commit (use "git add file1 file2" to include for commit)'
+       fi
        save_index &&
        (
                cd_to_toplevel &&
@@ -617,6 +621,9 @@ else
 fi
 ret="$?"
 rm -f "$GIT_DIR/COMMIT_MSG" "$GIT_DIR/COMMIT_EDITMSG" "$GIT_DIR/SQUASH_MSG"
+
+cd_to_toplevel
+
 if test -d "$GIT_DIR/rr-cache"
 then
        git-rerere