]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t2070-restore.sh
Merge branch 'bc/author-committer-doc' into maint
[thirdparty/git.git] / t / t2070-restore.sh
index 21c3f84459dfe29053bbb0d9a43160a6df33f737..076d0df7fc0602e8d47c03ffa6ddb6dff0b985a9 100755 (executable)
@@ -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