diff --git a/git-commit.sh b/git-commit.sh index 5ea3fd0076..bb113e858b 100755 --- a/git-commit.sh +++ b/git-commit.sh @@ -404,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 diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh index f178f56208..b151b51a34 100644 --- a/t/t7501-commit.sh +++ b/t/t7501-commit.sh @@ -131,7 +131,7 @@ test_expect_success \ 'validate git-rev-list output.' \ 'diff current expected' -test_expect_success 'partial commit that involve removal (1)' ' +test_expect_success 'partial commit that involves removal (1)' ' git rm --cached file && mv file elif && @@ -143,7 +143,7 @@ test_expect_success 'partial commit that involve removal (1)' ' ' -test_expect_success 'partial commit that involve removal (2)' ' +test_expect_success 'partial commit that involves removal (2)' ' git commit -m "Partial: remove file" file && git diff-tree --name-status HEAD^ HEAD >current && @@ -152,4 +152,15 @@ test_expect_success 'partial commit that involve removal (2)' ' ' +test_expect_success 'partial commit that involves removal (3)' ' + + git rm --cached elif && + echo elif >elif && + git commit -m "Partial: modify elif" elif && + git diff-tree --name-status HEAD^ HEAD >current && + echo "M elif" >expected && + diff expected current + +' + test_done