Code

git-commit --amend: allow empty commit.
authorJunio C Hamano <junkio@cox.net>
Sun, 5 Mar 2006 04:36:28 +0000 (20:36 -0800)
committerJunio C Hamano <junkio@cox.net>
Sun, 5 Mar 2006 08:57:01 +0000 (00:57 -0800)
When amending a commit only to update the commit log message, git-status
would rightly say "Nothing to commit."  Do not let this prevent commit to
be made.

Signed-off-by: Junio C Hamano <junkio@cox.net>
git-commit.sh

index d9ec1f14d9ec3336c4c772d0c03f30d5f1511d56..330a434b1891a67f78dfbb665558efef868bb704 100755 (executable)
@@ -609,7 +609,7 @@ fi
        test -z "$only_include_assumed" || echo "$only_include_assumed"
        run_status
 } >>"$GIT_DIR"/COMMIT_EDITMSG
-if [ "$?" != "0" -a ! -f "$GIT_DIR/MERGE_HEAD" ]
+if [ "$?" != "0" -a ! -f "$GIT_DIR/MERGE_HEAD" -a -z "$amend" ]
 then
        rm -f "$GIT_DIR/COMMIT_EDITMSG"
        run_status