Merge branch 'vn/restore-empty-ita-corner-case-fix'
authorJunio C Hamano <gitster@pobox.com>
Thu, 22 Aug 2019 19:34:11 +0000 (12:34 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 22 Aug 2019 19:34:11 +0000 (12:34 -0700)
"git checkout" and "git restore" to re-populate the index from a
tree-ish (typically HEAD) did not work correctly for a path that
was removed and then added again with the intent-to-add bit, when
the corresponding working tree file was empty. This has been
corrected.

* vn/restore-empty-ita-corner-case-fix:
restore: add test for deleted ita files
checkout.c: unstage empty deleted ita files

1  2 
builtin/checkout.c
diff --combined builtin/checkout.c
index 6123f732a2c84f975c576e7077a0c6da369e6b31,27daa09c3ce860f967802e9783afcf00d965fcbd..8d3ad7cd9e735fdece09793ec11995e7b91b5c6f
@@@ -126,6 -126,7 +126,7 @@@ static int update_some(const struct obj
        if (pos >= 0) {
                struct cache_entry *old = active_cache[pos];
                if (ce->ce_mode == old->ce_mode &&
+                   !ce_intent_to_add(old) &&
                    oideq(&ce->oid, &old->oid)) {
                        old->ce_flags |= CE_UPDATE;
                        discard_cache_entry(ce);
@@@ -1769,7 -1770,7 +1770,7 @@@ int cmd_restore(int argc, const char **
        struct option *options;
        struct option restore_options[] = {
                OPT_STRING('s', "source", &opts.from_treeish, "<tree-ish>",
 -                         N_("where the checkout from")),
 +                         N_("which tree-ish to checkout from")),
                OPT_BOOL('S', "staged", &opts.checkout_index,
                           N_("restore the index")),
                OPT_BOOL('W', "worktree", &opts.checkout_worktree,