Merge branch 'jc/merge'
[git.git] / git-commit.sh
index c9c22ab..1e7c09e 100755 (executable)
@@ -161,7 +161,7 @@ run_status () {
            }
        '
 
-       if test -n "$verbose"
+       if test -n "$verbose" -a -z "$IS_INITIAL"
        then
            git-diff-index --cached -M -p --diff-filter=MDTCRA $REFERENCE
        fi
@@ -595,19 +595,21 @@ then
                PARENTS=$(git-cat-file commit HEAD |
                        sed -n -e '/^$/q' -e 's/^parent /-p /p')
        fi
+       current=$(git-rev-parse --verify HEAD)
 else
        if [ -z "$(git-ls-files)" ]; then
                echo >&2 Nothing to commit
                exit 1
        fi
        PARENTS=""
+       current=
 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