restore: add test for deleted ita files
authorVarun Naik <vcnaik94@gmail.com>
Thu, 1 Aug 2019 16:09:10 +0000 (09:09 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 2 Aug 2019 17:28:25 +0000 (10:28 -0700)
`git restore --staged` uses the same machinery as `git checkout HEAD`,
so there should be a similar test case for "restore" as the existing
test case for "checkout" with deleted ita files.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Varun Naik <vcnaik94@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t2070-restore.sh
index 2650df196670b8a98d7ba558b108e2d07697dfdc..21c3f84459dfe29053bbb0d9a43160a6df33f737 100755 (executable)
@@ -95,4 +95,15 @@ test_expect_success 'restore --ignore-unmerged ignores unmerged entries' '
        )
 '
 
+test_expect_success 'restore --staged adds deleted intent-to-add file back to index' '
+       echo "nonempty" >nonempty &&
+       >empty &&
+       git add nonempty empty &&
+       git commit -m "create files to be deleted" &&
+       git rm --cached nonempty empty &&
+       git add -N nonempty empty &&
+       git restore --staged nonempty empty &&
+       git diff --cached --exit-code
+'
+
 test_done