git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Antonin Delpeuch <antonin@delpeuch.eu>
Cc: Antonin Delpeuch via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org
Subject: Re: [PATCH v3] merge-ll: expose revision names to custom drivers
Date: Sat, 20 Jan 2024 09:25:29 -0800	[thread overview]
Message-ID: <xmqqy1cjgbna.fsf@gitster.g> (raw)
In-Reply-To: <386c0318-0138-47c9-9e7f-d1004277226c@delpeuch.eu> (Antonin Delpeuch's message of "Fri, 19 Jan 2024 21:02:35 +0100")

Antonin Delpeuch <antonin@delpeuch.eu> writes:

> After more testing (combining custom merge drivers with rerere) I
> realized that my patch can lead to a segmentation error. Many
> apologies for not having caught that earlier!

Ah, understandable.  The 3-way merge machinery may not even have to
work on commit objects (it can merge two trees, using another tree
as the "common ancestor" tree, just fine).

And in such a case, it is perfectly possible there is no "human
readable name"; all there is may be a tree object name.

> On 18/01/2024 23:09, Antonin Delpeuch via GitGitGadget wrote:
>> @@ -222,6 +222,12 @@ static enum ll_merge_result ll_ext_merge(const struct ll_merge_driver *fn,
>>   			strbuf_addf(&cmd, "%d", marker_size);
>>   		else if (skip_prefix(format, "P", &format))
>>   			sq_quote_buf(&cmd, path);
>> +		else if (skip_prefix(format, "S", &format))
>> +			sq_quote_buf(&cmd, orig_name);
>> +		else if (skip_prefix(format, "X", &format))
>> +			sq_quote_buf(&cmd, name1);
>> +		else if (skip_prefix(format, "Y", &format))
>> +			sq_quote_buf(&cmd, name2);
>
> The "orig_name", "name1" and "name2" pointers can be NULL at this
> stage. This can happen when the merge is invoked from rerere, to
> resolve a conflict using a previous resolution.

	sq_quote_buf(&cmd, name1 ? name1 : "(ours)");

or something like that, perhaps.


  reply	other threads:[~2024-01-20 17:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18 14:26 [PATCH] merge-ll: expose revision names to custom drivers Antonin Delpeuch via GitGitGadget
2024-01-18 15:25 ` Kristoffer Haugsbakk
2024-01-18 15:42   ` Antonin Delpeuch
2024-01-18 15:43 ` [PATCH v2] " Antonin Delpeuch via GitGitGadget
2024-01-18 20:16   ` Junio C Hamano
2024-01-18 20:56     ` Antonin Delpeuch
2024-01-18 22:09   ` [PATCH v3] " Antonin Delpeuch via GitGitGadget
2024-01-19 20:02     ` Antonin Delpeuch
2024-01-20 17:25       ` Junio C Hamano [this message]
2024-01-20 14:13     ` Phillip Wood
2024-01-20 17:37       ` Junio C Hamano
2024-01-20 18:23         ` Phillip Wood
2024-01-20 22:49       ` Junio C Hamano
2024-01-24 20:09     ` [PATCH v4] " Antonin Delpeuch via GitGitGadget
2024-01-24 21:17       ` 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

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

  git send-email \
    --in-reply-to=xmqqy1cjgbna.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=antonin@delpeuch.eu \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.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).