summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-07-14 04:36:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-07-14 04:39:18 (GMT)
commitff00b682f203eb39876b57404916b4c54b6032c6 (patch)
tree02a3db584eb73b44ccd2a4e719c77ca0ed2690e1 /t
parentd28790dc31ca1bcdca7254a6b9381b6c84e91271 (diff)
downloadgit-ff00b682f203eb39876b57404916b4c54b6032c6.zip
git-ff00b682f203eb39876b57404916b4c54b6032c6.tar.gz
git-ff00b682f203eb39876b57404916b4c54b6032c6.tar.bz2
reset [<commit>] paths...: do not mishandle unmerged paths
Because "diff --cached HEAD" showed an incorrect blob object name on the LHS of the diff, we ended up updating the index entry with bogus value, not what we read from the tree. Noticed by John Nowak. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t7102-reset.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index f1cfc9a..b096dc8 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -429,6 +429,21 @@ test_expect_success '--mixed refreshes the index' '
test_i18ncmp expect output
'
+test_expect_success 'resetting specific path that is unmerged' '
+ git rm --cached file2 &&
+ F1=$(git rev-parse HEAD:file1) &&
+ F2=$(git rev-parse HEAD:file2) &&
+ F3=$(git rev-parse HEAD:secondfile) &&
+ {
+ echo "100644 $F1 1 file2" &&
+ echo "100644 $F2 2 file2" &&
+ echo "100644 $F3 3 file2"
+ } | git update-index --index-info &&
+ git ls-files -u &&
+ test_must_fail git reset HEAD file2 &&
+ git diff-index --exit-code --cached HEAD
+'
+
test_expect_success 'disambiguation (1)' '
git reset --hard &&