Code

Do not over-quote the -f envelopesender value.
[git.git] / git-commit.sh
index d7e7028c15aeceaf2ba64a82ee9fc15f54b20eaa..7a7a2cb4b47c62d4826aabd9d90a7af26427f980 100755 (executable)
@@ -49,10 +49,11 @@ run_status () {
                export GIT_INDEX_FILE
        fi
 
-       case "$status_only" in
-       t) color= ;;
-       *) color=--nocolor ;;
-       esac
+       if test "$status_only" = "t" -o "$use_status_color" = "t"; then
+               color=
+       else
+               color=--nocolor
+       fi
        git runstatus ${color} \
                ${verbose:+--verbose} \
                ${amend:+--amend} \
@@ -88,7 +89,7 @@ force_author=
 only_include_assumed=
 untracked_files=
 templatefile="`git config commit.template`"
-while case "$#" in 0) break;; esac
+while test $# != 0
 do
        case "$1" in
        -F|--F|-f|--f|--fi|--fil|--file)
@@ -378,8 +379,11 @@ t,)
                then
                        refuse_partial "Cannot do a partial commit during a merge."
                fi
+
                TMP_INDEX="$GIT_DIR/tmp-index$$"
-               commit_only=`git ls-files --error-unmatch -- "$@"` || exit
+               W=
+               test -z "$initial_commit" && W=--with-tree=HEAD
+               commit_only=`git ls-files --error-unmatch $W -- "$@"` || exit
 
                # Build a temporary index and update the real index
                # the same way.
@@ -400,7 +404,7 @@ t,)
                (
                        GIT_INDEX_FILE="$NEXT_INDEX"
                        export GIT_INDEX_FILE
-                       git update-index --remove --stdin
+                       git update-index --add --remove --stdin
                ) || exit
                ;;
        esac
@@ -553,9 +557,10 @@ else
        # we need to check if there is anything to commit
        run_status >/dev/null
 fi
-if [ "$?" != "0" -a ! -f "$GIT_DIR/MERGE_HEAD" -a -z "$amend" ]
+if [ "$?" != "0" -a ! -f "$GIT_DIR/MERGE_HEAD" ]
 then
        rm -f "$GIT_DIR/COMMIT_EDITMSG" "$GIT_DIR/SQUASH_MSG"
+       use_status_color=t
        run_status
        exit 1
 fi