git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Schalk\, Ken" <ken.schalk@intel.com>
Cc: "git\@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH] Avoid rename/add conflict when contents are identical
Date: Thu, 12 Aug 2010 18:18:19 -0700	[thread overview]
Message-ID: <7vd3tnmht0.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <5C4EA6C5B30E6B45A9164CB3A26A0D326F79D9AA04@azsmsx503.amr.corp.intel.com> (Ken Schalk's message of "Mon\, 9 Aug 2010 14\:00\:31 -0700")

"Schalk, Ken" <ken.schalk@intel.com> writes:

> diff --git a/merge-recursive.c b/merge-recursive.c
> index fb6aa4a..57c7a85 100644
> --- a/merge-recursive.c
> +++ b/merge-recursive.c
> @@ -955,6 +955,18 @@ static int process_renames(struct merge_options *o,
>                                                         ren1->pair->two : NULL,
>                                                         branch1 == o->branch1 ?
>                                                         NULL : ren1->pair->two, 1);
> +                       } else if ((dst_other.mode == ren1->pair->two->mode) &&
> +                                  sha_eq(dst_other.sha1, ren1->pair->two->sha1)) {
> +                               /* Added file on the other side
> +                                  identical to the file being
> +                                  renamed: clean merge */
> +                               update_file(o, 1, ren1->pair->two->sha1, ren1->pair->two->mode, ren1_dst);
> +                               if (!o->call_depth)
> +                                       update_stages(ren1_dst, NULL,
> +                                                       branch1 == o->branch1 ?
> +                                                       ren1->pair->two : NULL,
> +                                                       branch1 == o->branch1 ?
> +                                                       NULL : ren1->pair->two, 1);
>                         } else if (!sha_eq(dst_other.sha1, null_sha1)) {
>                                 const char *new_path;
>                                 clean_merge = 0;

The logic seems to be clear enough.  Could you write a test script instead
of description in the commit log message, so that future changes to the
codebase won't break this improvement?

Thanks.

  parent reply	other threads:[~2010-08-13  1:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-09 21:00 [PATCH] Avoid rename/add conflict when contents are identical Schalk, Ken
2010-08-09 21:24 ` Ævar Arnfjörð Bjarmason
2010-08-13  1:18 ` Junio C Hamano [this message]
2010-08-27 22:14   ` Schalk, Ken
2010-08-28 10:12     ` Ævar Arnfjörð Bjarmason
2010-08-31 21:05       ` Schalk, Ken
2010-09-01 20:15       ` Schalk, Ken
2010-09-03 18:29         ` Junio C Hamano

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=7vd3tnmht0.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=ken.schalk@intel.com \
    /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).