diff mbox series

restore: add test for deleted ita files

Message ID 20190801160910.12652-1-vcnaik94@gmail.com (mailing list archive)
State New, archived
Headers show
Series restore: add test for deleted ita files | expand

Commit Message

Varun Naik Aug. 1, 2019, 4:09 p.m. UTC
`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>
---
This is the "restore" patch based on the merge of the "checkout" patch
into master.

 t/t2070-restore.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Junio C Hamano Aug. 2, 2019, 4:16 p.m. UTC | #1
Varun Naik <vcnaik94@gmail.com> writes:

> `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>
> ---
> This is the "restore" patch based on the merge of the "checkout" patch
> into master.

Makes sense.  Thanks.
diff mbox series

Patch

diff --git a/t/t2070-restore.sh b/t/t2070-restore.sh
index 2650df1966..21c3f84459 100755
--- a/t/t2070-restore.sh
+++ b/t/t2070-restore.sh
@@ -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