git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] restore: add test for deleted ita files

From
Varun Naik <vcnaik94@gmail.com>
Date
Aug 1, 2019, 16:09 UTC
Message-ID
<20190801160910.12652-1-vcnaik94@gmail.com>
In-Reply-To
<20190726045645.2437-1-vcnaik94@gmail.com>

`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(+)
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
-- 
2.22.0
Previous: Jeff KingNext: Junio C Hamano
Message 9 of 11 in “checkout.c: unstage empty deleted ita files”
  1. checkout.c: unstage empty deleted ita filesVarun Naik, Jul 26, 2019
  2. Varun NaikJul 26, 2019
  3. Jeff KingJul 26, 2019
  4. Varun NaikJul 29, 2019
  5. Jeff KingJul 29, 2019
  6. checkout.c: unstage empty deleted ita filesVarun Naik, Aug 1, 2019
  7. Junio C HamanoAug 1, 2019
  8. Jeff KingAug 1, 2019
  9. restore: add test for deleted ita filesVarun Naik, Aug 1, 2019
  10. Junio C HamanoAug 2, 2019
  11. checkout.c: unstage empty deleted ita filesVarun Naik, Aug 2, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.