git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Varun Naik <vcnaik94@gmail.com>
To: vcnaik94@gmail.com
Cc: git@vger.kernel.org, peff@peff.net, gitster@pobox.com
Subject: [PATCH] restore: add test for deleted ita files
Date: Thu,  1 Aug 2019 09:09:10 -0700	[thread overview]
Message-ID: <20190801160910.12652-1-vcnaik94@gmail.com> (raw)
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


  parent reply	other threads:[~2019-08-01 16:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-26  4:56 [PATCH] checkout.c: unstage empty deleted ita files Varun Naik
2019-07-26  5:01 ` Varun Naik
2019-07-26  8:57 ` Jeff King
2019-07-29  6:54   ` Varun Naik
2019-07-29  9:11     ` Jeff King
2019-08-01 16:07 ` [PATCH v2] " Varun Naik
2019-08-01 17:34   ` Junio C Hamano
2019-08-01 21:51   ` Jeff King
2019-08-01 16:09 ` Varun Naik [this message]
2019-08-02 16:16   ` [PATCH] restore: add test for " Junio C Hamano
2019-08-02 16:28 ` [PATCH v3] checkout.c: unstage empty " Varun Naik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190801160910.12652-1-vcnaik94@gmail.com \
    --to=vcnaik94@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).