Linus Torvalds [off-list ref] writes:
I think that is actually a misfeature.
This _should_ just work. It's the easy and logical way to do it, and it's
the one that matches all the other behaviours of "git commit" these days.
...
So anyway, I would suggest that we just get rid of that partial commit
"safety check" in "git commit" for now. It still makes sense for when
you're in the middle of a _merge_, but the "verify that index matches" is
not worth it.
The codepath has a big "don't do this during a merge" check in
front. I think this is a safe thing to do, so let's do this.
diff --git a/git-commit.sh b/git-commit.sh
index 81c3a0c..c829791 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -350,19 +350,9 @@ t,)
refuse_partial "Cannot do a partial commit during a merge."
fi
TMP_INDEX="$GIT_DIR/tmp-index$$"
- if test -z "$initial_commit"
- then
- # make sure index is clean at the specified paths, or
- # they are additions.
- dirty_in_index=`git-diff-index --cached --name-status \
- --diff-filter=DMTU HEAD -- "$@"`
- test -z "$dirty_in_index" ||
- refuse_partial "Different in index and the last commit:
-$dirty_in_index"
- fi
commit_only=`git-ls-files --error-unmatch -- "$@"` || exit
- # Build the temporary index and update the real index
+ # Build a temporary index and update the real index
# the same way.
if test -z "$initial_commit"
then