From: Junio C Hamano <gitster@pobox.com>
To: Mikhail Filippov <mikhail@filippov.me>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Do not record unstaged deleted file upon recursive merge if file was moved outside of working tree with enabled sparse-checkout.
Date: Sun, 11 Sep 2016 16:24:11 -0700 [thread overview]
Message-ID: <xmqqeg4q6mw4.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <1473625505-7641-1-git-send-email-mikhail@filippov.me> (Mikhail Filippov's message of "Sun, 11 Sep 2016 23:25:05 +0300")
Mikhail Filippov <mikhail@filippov.me> writes:
> ---
You'd need a lot more explanation on why this is needed
(i.e. without it what behaviour you would get, and why that
behaviour is wrong).
> merge-recursive.c | 9 +++++---
> t/t6042-merge-rename-corner-cases.sh | 42 ++++++++++++++++++++++++++++++++++++
> 2 files changed, 48 insertions(+), 3 deletions(-)
>
> diff --git a/merge-recursive.c b/merge-recursive.c
> index e349126..25dc701 100644
> --- a/merge-recursive.c
> +++ b/merge-recursive.c
> @@ -1724,9 +1724,12 @@ static int merge_content(struct merge_options *o,
> */
> path_renamed_outside_HEAD = !path2 || !strcmp(path, path2);
> if (!path_renamed_outside_HEAD) {
> - add_cacheinfo(o, mfi.mode, &mfi.oid, path,
> - 0, (!o->call_depth), 0);
> - return mfi.clean;
> + struct stat st;
> + if (lstat(path, &st) == 0) {
> + add_cacheinfo(o, mfi.mode, &mfi.oid, path,
> + 0, (!o->call_depth), 0);
> + return mfi.clean;
> + }
I cannot guess what you are trying to achieve without explanation in
the proposed log message, but I can say that this unconditional
checking of a working tree file cannot be correct (there may or may
not be other things that are wrong with this change, which cannot be
judged without more information).
Imagine your o->call_depth is not zero, i.e. we are making a virtual
common ancestor with this merge, in which case any of the three
trees involved may have nothing to do with the current working tree
files.
> +test_expect_success 'move file/sparse-checkout/merge should not delete moved file' '
> + git rm -rf . &&
> + git clean -fdqx &&
> + rm -rf .git &&
> + git init &&
Yuck. This is inherited from existing tests but I think they need
to be cleaned up. It is not your fault, and it is not in the scope
of this change.
> + git status >output &&
> + cp output /tmp/a &&
Huh?
> + test_i18ngrep "nothing to commit" output
> +'
> +
> test_done
next prev parent reply other threads:[~2016-09-11 23:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-11 20:25 [PATCH] Do not record unstaged deleted file upon recursive merge if file was moved outside of working tree with enabled sparse-checkout Mikhail Filippov
2016-09-11 23:24 ` Junio C Hamano [this message]
2016-09-12 8:38 ` Mikhail Filippov
2016-09-12 11:07 ` Mikhail Filippov
-- strict thread matches above, loose matches on Subject: below --
2016-09-12 11:24 Mikhail Filippov
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=xmqqeg4q6mw4.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=mikhail@filippov.me \
/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).