From: Junio C Hamano Date: Thu, 22 Aug 2019 19:34:11 +0000 (-0700) Subject: Merge branch 'vn/restore-empty-ita-corner-case-fix' X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/072735ea58407db41c0874fd2f8a91d0c191d49b?ds=inline;hp=-c Merge branch 'vn/restore-empty-ita-corner-case-fix' "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 --- 072735ea58407db41c0874fd2f8a91d0c191d49b diff --combined builtin/checkout.c index 6123f732a2,27daa09c3c..8d3ad7cd9e --- a/builtin/checkout.c +++ b/builtin/checkout.c @@@ -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, "", - 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,