summaryrefslogtreecommitdiff
path: root/t/t2070-restore.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-01-22 23:07:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-01-22 23:07:32 (GMT)
commit09e393d913072d7765b02aba1210d843a83cfbae (patch)
treeafb7a732a76346f4c3c9451c446c696326fa104d /t/t2070-restore.sh
parent45f47ff01d048d47f30e0a5cacb5c5768d4858be (diff)
parente701bab3e95f7029e59717eab610a544821b2213 (diff)
downloadgit-09e393d913072d7765b02aba1210d843a83cfbae.zip
git-09e393d913072d7765b02aba1210d843a83cfbae.tar.gz
git-09e393d913072d7765b02aba1210d843a83cfbae.tar.bz2
Merge branch 'nd/switch-and-restore'
"git restore --staged" did not correctly update the cache-tree structure, resulting in bogus trees to be written afterwards, which has been corrected. * nd/switch-and-restore: restore: invalidate cache-tree when removing entries with --staged
Diffstat (limited to 't/t2070-restore.sh')
-rwxr-xr-xt/t2070-restore.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/t/t2070-restore.sh b/t/t2070-restore.sh
index 21c3f84..076d0df 100755
--- a/t/t2070-restore.sh
+++ b/t/t2070-restore.sh
@@ -106,4 +106,21 @@ test_expect_success 'restore --staged adds deleted intent-to-add file back to in
git diff --cached --exit-code
'
+test_expect_success 'restore --staged invalidates cache tree for deletions' '
+ test_when_finished git reset --hard &&
+ >new1 &&
+ >new2 &&
+ git add new1 new2 &&
+
+ # It is important to commit and then reset here, so that the index
+ # contains a valid cache-tree for the "both" tree.
+ git commit -m both &&
+ git reset --soft HEAD^ &&
+
+ git restore --staged new1 &&
+ git commit -m "just new2" &&
+ git rev-parse HEAD:new2 &&
+ test_must_fail git rev-parse HEAD:new1
+'
+
test_done