git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Elijah Newren <newren@gmail.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: "Git Mailing List" <git@vger.kernel.org>,
	"Junio C Hamano" <gitster@pobox.com>,
	corrmage@gmail.com, "Ævar Arnfjörð" <avarab@gmail.com>,
	"Stefan Beller" <sbeller@google.com>
Subject: Re: [PATCH 2/3] merge-recursive: add ability to turn off directory rename detection
Date: Wed, 29 Aug 2018 16:00:48 -0700	[thread overview]
Message-ID: <CABPp-BHFrk026R5VZLGwVvRYq_d82GTFqAyAeyTD=iQX4df2Bw@mail.gmail.com> (raw)
In-Reply-To: <nycvar.QRO.7.76.6.1808291452070.71@tvgsbejvaqbjf.bet>

On Wed, Aug 29, 2018 at 5:54 AM Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
>
> Hi Elijah,
>
> On Wed, 29 Aug 2018, Elijah Newren wrote:
>
> > Signed-off-by: Elijah Newren <newren@gmail.com>
> > ---
> >  merge-recursive.c | 18 +++++++++++++-----
> >  merge-recursive.h |  1 +
> >  2 files changed, 14 insertions(+), 5 deletions(-)
> >
> > diff --git a/merge-recursive.c b/merge-recursive.c
> > index f110e1c5ec..bf3cb03d3a 100644
> > --- a/merge-recursive.c
> > +++ b/merge-recursive.c
> > @@ -2843,12 +2843,19 @@ static int handle_renames(struct merge_options *o,
> >       head_pairs = get_diffpairs(o, common, head);
> >       merge_pairs = get_diffpairs(o, common, merge);
> >
> > -     dir_re_head = get_directory_renames(head_pairs, head);
> > -     dir_re_merge = get_directory_renames(merge_pairs, merge);
> > +     if (o->detect_directory_renames) {
> > +             dir_re_head = get_directory_renames(head_pairs, head);
> > +             dir_re_merge = get_directory_renames(merge_pairs, merge);
> >
> > -     handle_directory_level_conflicts(o,
> > -                                      dir_re_head, head,
> > -                                      dir_re_merge, merge);
> > +             handle_directory_level_conflicts(o,
> > +                                              dir_re_head, head,
> > +                                              dir_re_merge, merge);
> > +     } else {
> > +             dir_re_head  = xmalloc(sizeof(*dir_re_head));
> > +             dir_re_merge = xmalloc(sizeof(*dir_re_merge));
>
> This is not a suggestion to change anything, but a genuine question out of
> curiosity: would it make sense to put the `dir_re_head` and `dir_re_merge`
> structures into `struct merge_options` to avoid these extra `malloc()`s?
> Or would that cause issues with the recursive nature of the recursive
> merge?

That would work to avoid the extra `malloc()`s, and be inline with the
current usage of merge_options.  However, I'm not sure I like the
current usage of merge_options. That struct is supposed to be public
API, but it's got a lot of private internal-only use stuff (and
putting dir_re_head and dir_re_merge there would add more).  I'm
tempted to go the other way and eject some of the other internal-only
stuff from merge_options (or wrap it inside an opaque struct
merge_options_internal* internal field, or something like that).

  reply	other threads:[~2018-08-29 23:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28 12:27 A rebase regression in Git 2.18.0 Nikolay Kasyanov
2018-08-28 13:17 ` Ævar Arnfjörð Bjarmason
2018-08-28 13:33   ` Johannes Schindelin
2018-08-28 13:46     ` Nikolay Kasyanov
2018-08-28 15:35     ` Elijah Newren
2018-08-28 16:58       ` Junio C Hamano
2018-08-29  7:06         ` [PATCH 0/3] Turn off directory rename detection in am -3 Elijah Newren
2018-08-29  7:06           ` [PATCH 1/3] t3401: add another directory rename testcase for rebase and am Elijah Newren
2018-08-29 22:12             ` Junio C Hamano
2018-08-29 23:47               ` Elijah Newren
2018-08-30 16:01                 ` Junio C Hamano
2018-08-30 16:26                   ` Elijah Newren
2018-08-29  7:06           ` [PATCH 2/3] merge-recursive: add ability to turn off directory rename detection Elijah Newren
2018-08-29 12:54             ` Johannes Schindelin
2018-08-29 23:00               ` Elijah Newren [this message]
2018-08-29  7:06           ` [PATCH 3/3] am: avoid directory rename detection when calling recursive merge machinery Elijah Newren
2018-08-29 12:51             ` Johannes Schindelin
2018-08-30 16:41         ` A rebase regression in Git 2.18.0 Elijah Newren
2018-08-31 10:11           ` Johannes Schindelin
2018-08-31 19:37             ` Elijah Newren

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABPp-BHFrk026R5VZLGwVvRYq_d82GTFqAyAeyTD=iQX4df2Bw@mail.gmail.com' \
    --to=newren@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=avarab@gmail.com \
    --cc=corrmage@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sbeller@google.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.
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 NNTP newsgroup(s).