summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-02-21 02:06:03 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-02-21 02:06:03 (GMT)
commitfcb202e227a2cb8d549026e6ea2a0ef33fdb1ac3 (patch)
tree79a856897d260b127e508dfa1867cadd8c4b1837
parent9fa963663f10a1e35223cb76fe32dd25d5492956 (diff)
parentbd9e17da583b14e07724baca4351942f3484f8f8 (diff)
downloadgit-fcb202e227a2cb8d549026e6ea2a0ef33fdb1ac3.zip
git-fcb202e227a2cb8d549026e6ea2a0ef33fdb1ac3.tar.gz
git-fcb202e227a2cb8d549026e6ea2a0ef33fdb1ac3.tar.bz2
Merge branch 'vn/reset-deleted-ita' into pu
"git reset HEAD [<pathspec>]" did not reset an empty file that was added with the intent-to-add bit. * vn/reset-deleted-ita: reset: unstage empty deleted ita files
-rw-r--r--builtin/reset.c1
-rwxr-xr-xt/t7102-reset.sh11
2 files changed, 12 insertions, 0 deletions
diff --git a/builtin/reset.c b/builtin/reset.c
index 18228c3..ef5b5ec 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -164,6 +164,7 @@ static int read_from_tree(const struct pathspec *pathspec,
opt.format_callback_data = &intent_to_add;
opt.flags.override_submodule_config = 1;
opt.repo = the_repository;
+ opt.ita_invisible_in_index = 1;
if (do_diff_cache(tree_oid, &opt))
return 1;
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index 97be0d9..a99e97c 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -566,4 +566,15 @@ test_expect_success 'reset --mixed sets up work tree' '
test_must_be_empty actual
'
+test_expect_success 'reset --mixed 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 reset HEAD nonempty empty &&
+ git diff --cached --exit-code HEAD
+'
+
test_done