git-commit: allow --only to lose what was staged earlier.
The command used to have a safety valve to prevent this sequence: edit foo git update-index foo edit foo git diff foo git commit --only foo The reason for this was because an inexperienced user might mistakenly think what is shown with the last-minute diff contains all the change that is being committed (instead, what the user asked to check was an incremental diff since what has been staged so far). However, this turns out to only annoy people who know what they are doing. Inexperienced people would not be using the first "update-index" anyway, in which case they would see the full changes in the "git diff". Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Dec 9, 2006 at 22:32 UTC
158d0577891441c01457bbcaf45585d3b50f5d75
1 file changed
+1
-11
git-commit.sh
+1
-11
@@ -350,19 +350,9 @@ t,)
350
refuse_partial "Cannot do a partial commit during a merge."
351
fi
352
TMP_INDEX="$GIT_DIR/tmp-index$$"
353
- if test -z "$initial_commit"
354
- then
355
- # make sure index is clean at the specified paths, or
356
- # they are additions.
357
- dirty_in_index=`git-diff-index --cached --name-status \
358
- --diff-filter=DMTU HEAD -- "$@"`
359
- test -z "$dirty_in_index" ||
360
- refuse_partial "Different in index and the last commit:
361
-$dirty_in_index"
362
- fi
353
commit_only=`git-ls-files --error-unmatch -- "$@"` || exit
354
365
- # Build the temporary index and update the real index
355
+ # Build a temporary index and update the real index
356
# the same way.
357
if test -z "$initial_commit"
358
then