@matheusbsbs / matheus-bagliano / commits / db33af0a7f
Fork 0

git-commit: partial commit of paths only removed from the index

Because a partial commit is meant to be a way to ignore what are staged in the index, "git rm --cached A && git commit A" should just record what is in A on the filesystem. The previous patch made the command sequence to barf, saying that A has not been added yet. This fixes it. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Sep 14, 2007 at 16:53 UTC db33af0a7f64ffc48de3ad018a1df03f744fb7a2
2 files changed +14 -3
git-commit.sh
+1 -1
@@ -404,7 +404,7 @@ t,)
404 (
405 GIT_INDEX_FILE="$NEXT_INDEX"
406 export GIT_INDEX_FILE
407 - git update-index --remove --stdin
407 + git update-index --add --remove --stdin
408 ) || exit
409 ;;
410 esac
t/t7501-commit.sh
+13 -2
@@ -131,7 +131,7 @@ test_expect_success \
131 'validate git-rev-list output.' \
132 'diff current expected'
133
134 -test_expect_success 'partial commit that involve removal (1)' '
134 +test_expect_success 'partial commit that involves removal (1)' '
135
136 git rm --cached file &&
137 mv file elif &&
@@ -143,7 +143,7 @@ test_expect_success 'partial commit that involve removal (1)' '
143
144 '
145
146 -test_expect_success 'partial commit that involve removal (2)' '
146 +test_expect_success 'partial commit that involves removal (2)' '
147
148 git commit -m "Partial: remove file" file &&
149 git diff-tree --name-status HEAD^ HEAD >current &&
@@ -152,4 +152,15 @@ test_expect_success 'partial commit that involve removal (2)' '
152
153 '
154
155 +test_expect_success 'partial commit that involves removal (3)' '
156 +
157 + git rm --cached elif &&
158 + echo elif >elif &&
159 + git commit -m "Partial: modify elif" elif &&
160 + git diff-tree --name-status HEAD^ HEAD >current &&
161 + echo "M elif" >expected &&
162 + diff expected current
163 +
164 +'
165 +
166 test_done