diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-07-13 21:36:29 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-07-13 21:39:18 -0700 |
commit | ff00b682f203eb39876b57404916b4c54b6032c6 (patch) | |
tree | 02a3db584eb73b44ccd2a4e719c77ca0ed2690e1 /t/t7102-reset.sh | |
parent | d28790dc31ca1bcdca7254a6b9381b6c84e91271 (diff) | |
download | git-ff00b682f203eb39876b57404916b4c54b6032c6.tar.gz |
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/t7102-reset.sh')
-rwxr-xr-x | t/t7102-reset.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh index f1cfc9ac95..b096dc88c2 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 && |