🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #3090

Re: [PATCH/RFC 1/5] replay: support replaying 2-parent merges

#3090
From: Philippe Blain
Date: Fri, 13 Nov 2026 13:03
97 lines
14839 bytes

> Le 5 nov. 2026 à 07:38, Philippe Blain <levraiphilippeblain@gmail.com> a écrit :
> Hi Dscho,
> 
>> Le 4 nov. 2026 à 21:19, Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com> a écrit :
>> From: Johannes Schindelin <johannes.schindelin@gmx.de>
> 
>> @@ -407,17 +550,63 @@ int replay_revisions(struct rev_info *revs,
>>   merge_opt.show_rename_progress = 0;
>>   last_commit = onto;
>>   replayed_commits = kh_init_oid_map();
>> +
>> +    /*
>> +     * Seed the rewritten-commit map with each negative-side ("BOTTOM")
>> +     * cmdline entry pointing at `onto`. This matters for merge replay:
>> +     * a 2-parent merge whose first parent is the boundary (e.g. the
>> +     * commit being reworded) must replay onto the rewritten boundary,
>> +     * yet pick_merge_commit uses a self fallback so the second parent
>> +     * (a side branch outside the rewrite range) is preserved as-is.
>> +     * Pre-seeding the boundary disambiguates the two: in the map ->
>> +     * rewritten, missing -> kept as-is.
>> +     *
>> +     * Only do this for the pick path; revert mode chains reverts
>> +     * through last_commit and a pre-seeded boundary would short-circuit
>> +     * that chain.
>> +     */
>> +    if (mode == REPLAY_MODE_PICK) {
>> +        for (size_t i = 0; i < revs->cmdline.nr; i++) {
>> +            struct rev_cmdline_entry *e = &revs->cmdline.rev[i];
>> +            struct commit *boundary;
>> +            khint_t pos;
>> +            int hr;
>> +
>> +            if (!(e->flags & BOTTOM))
>> +                continue;
>> +            boundary = lookup_commit_reference_gently(revs->repo,
>> +                                  &e->item->oid, 1);
>> +            if (!boundary)
>> +                continue;
>> +            pos = kh_put_oid_map(replayed_commits,
>> +                         boundary->object.oid, &hr);
>> +            if (hr != 0)
>> +                kh_value(replayed_commits, pos) = onto;
>> +        }
>> +    }
>> +
> 
> I understand the intent here, we seed the replayed commit map with onto for the negative revisions, so that a merge with its first parent at the boundary gets its first parent rewritten to onto, but keeps its second parent.  But I think a further tweak is necessary.
> 
> I tried the following:
> - amend the first parent of a merge M (manually, in detached HEAD), changing only the commit message
> - try to replay the merge. Since none of the trees have changed, and the merge-base hasn’t changed, I expect replay to succeed and keep manually resolutions from M. I ran this:
> 
> git replay --onto HEAD M^!
> 
> and because with this syntax M^2 is a negative revision, it gets mapped to onto, whereas from what I understand it should _not_ be mapped and should be left untouched by replay: the new merge should have M^2 as second parent.

After reading Elijah’s tip commit message on his replay-upstream branch, which does the same pre-seeding as is done in yours, I understand that I can achieve what I want via 

git replay --onto HEAD ^M^1 M --ancestry-path

which covers this use case, and also covers rewriting only the second parent too. I think it might be useful to mention the fact that negative revisions are mapped to onto in the documentation of 'git replay' ? At least, I think it might not be obvious to some users that to replay a merge with only one of its parent changed, you can’t use M^! and must use --ancestry-path. 

> Since the second parent gets mapped to onto, the merge-base of the replayed merge is changed, so the fast past is skipped,  the new merge conflicts and the replay fails.
> 
> Also, I think this pre-seeding should be mentionned in the commit message.

Reading Elijah’s branch, this pre-seeding logic might even deserves its own commit ? I like how Elijah explains how we extend the ruleset on how to choose a replayed commit’s parent(s). 

Cheers,

Philippe.
Technical Details
Message-ID: <DF02C354-A49F-4FC2-9A52-FBFBB46C143A@gmail.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-75373-linux-kernel-git=dewy.ru
References: <0107772D-4F64-4F24-9E68-C6709AF264EA@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-75373-linux-kernel-git=dewy.ru
From: levraiphilippeblain@gmail.com (Philippe Blain)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH/RFC 1/5] replay: support replaying 2-parent merges
Date: Fri, 13 Nov 2026 08:03:35 -0500
Organization: Usenet Network
Message-ID: <DF02C354-A49F-4FC2-9A52-FBFBB46C143A@gmail.com>
References: <0107772D-4F64-4F24-9E68-C6709AF264EA@gmail.com>
MIME-Version: 1.0 (1.0)
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="1436609"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:0FATUbGcJTz1MwwnJdIiEBjDtjQ= sha256:271nHOY2fsLBsP/nJ8m7kgmcRHd26q18cPPsK4VvrMc=
	sha1:QeHEE584qvJkvg5TDHWu7XOxag0= sha256:YmPTWRTAYbDfSivhLEbhvhXx3c9bPZlAzClFkyt6aUk=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id E79FA11466F; Fri, 13 Nov 2026 23:58:30 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.949
X-Spam-Status: No, score=-1.949 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id eTp5c8ydw3Bw;
	Fri, 13 Nov 2026 23:58:27 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=git+bounces-75373-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 6FAD311464A; Fri, 13 Nov 2026 23:58:18 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id E6F83149426; Fri, 13 Nov 2026 13:03:50 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794575029;
	b=FguFu3NCq3yt9O5rquFCPw+vIaxT27fvUKbj448ubbMrrvXc6yr2auPsiPyIb7Zd+p2z
	 8N/iS5M1yAjBCWF72dKlp4VxGIzeUcCw5V9PFdtU5otQhIbMTjEJaTOPFjyHaixOmA47q
	 Fp6ZX0cD1QxiNyHnn7jeJTkKAqGAk4j4aC4/7nabxHiaqJKkPYlxZ+8hR3DD9tTPDN1MR
	 umldo5ykAVX6V9L5r4NL6DKvYIPnlvGdxQPpeum7Fs38AFWffBWbKBN+C+FVlSNchuoF6
	 HcyzMwaCzuy60SRc90bFaZ0gYiVHLx56D7jijheMAKloc8HKvdhZ89ShWuk+OkG27uw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794575029;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:Content-Type:Content-Transfer-Encoding:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:Mime-Version:Subject:From:In-Reply-To:Cc:Date:
	 Message-Id:References:To:X-Mailer;
	bh=IW8bUyh5kynkixJR5Jc86gk1A1wz3NKp4wAhJZTqrPU=;
	b=QXrvV2WQI6pvaPlIGx6rNEVAd4ZomeYalDNyl2lHv7RYeemJtbdTRcVIgL2pr9p0vdQI
	 V4Aw4MDoVBNhyS0gCLG/G9hGyPkcfaFDPJg9dqNqK/cCcgwcZrljLWApVHNNpqVRjg3p3
	 W7ejnJxPBDtS9uRdzs3vO0IQqKpewQl56t7iboVLhJ1yZ9+bpXZQIaO07GLN8o5kNLXCE
	 //JGEDa1c50Dzq+e85CxjYtmEbqIY0n6iQl29ZLLC+IVqixaGFRD65mLY07pP4lnkRMlN
	 0q1DUjsiDrNKE0fx9WckOI3wqUHcwFev0cpfXZoOo2i9efG61e1w8vvkm6I2ibsySoA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=mQLGwyp+;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 871D8606A330;
	Fri, 13 Nov 2026 13:03:49 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=mQLGwyp+
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.217.52
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794575028;
	b=AzGLd0uMRd94Xcg+EF/w4ffON2z8mTltV8nzVuGgOo7qymtCBRklqagK3/28eow1zHA/
	 yhafpU7vot29tsI90xxoGhs07MfC8UavYbz1CivBj8HJWNJ7r/7QWFywJxKHgbhFK5Gbn
	 SOw/aZQcgSKgAAxw7PG14lWNMxpDmKEF74zu3z4XvzrC9PPlyxO8NJvnO4qXJAJ+MO+V0
	 j4ndRJV+OnJ7AtGE2oThDoSArj92O9mAKLiehn4zfx0C35DopfNQY3FurPXBOufJupMb2
	 ajEgcDMNFx2bhzqxPY1m/R0Xfn2v0TUVG9L2rJ9u6oRT07X3qUEGSrOu9E8onXVeYlQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794575028;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Content-Type:
	 Content-Transfer-Encoding:Mime-Version:Subject:From:In-Reply-To:Cc:
	 Date:Message-Id:References:To:X-Mailer;
	bh=IW8bUyh5kynkixJR5Jc86gk1A1wz3NKp4wAhJZTqrPU=;
	b=oYqzxvhQ+spdFtTZkL+JbkW+1BWVtm/ggvWtATs2RrRJGb9GN6NshEcs/owbropDaXQv
	 94McAD0I5xav6pxs6LrRkPjHatmgKZGJM/1EdRl1Q84UjryxYVmVsah7PegHMtwdPbrGg
	 GrwsQ25hVyM/2IkB08cYavlc4hLSiP6ApfiFcg4Z0o876u5Q5/DlfNTbuVyRyh621WZMo
	 zG8RXeUcIZRvpl1dycbEKSB8eXgO0pcRasTQ8a6YGLFPbE2/9/wVLJ2llSbnEbdylse/a
	 wAxqsZmHdOHkkDxJpF08+GUtwhHZanNdjTAilIHoQ93G4l5ZpWPkStYKRiPDxoPXj0Q==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=mQLGwyp+;
	arc=none smtp.remote-ip=209.85.217.52
X-Received: from mail-vs1-f52.google.com (mail-vs1-f52.google.com [209.85.217.52])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54ABC606A327
	for <git@vger.kernel.org>; Fri, 13 Nov 2026 13:03:48 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 54ABC606A327
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-vs1-f52.google.com with SMTP id ada2fe7eead31-7cc1cf48a39so216359137.1
        for <git@vger.kernel.org>; Fri, 13 Nov 2026 05:03:48 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1794575027; x=1795179827; darn=vger.kernel.org;
        h=to:references:message-id:date:cc:in-reply-to:from:subject
         :mime-version:content-transfer-encoding:content-type:from:to:cc
         :subject:date:message-id:reply-to:content-type;
        bh=IW8bUyh5kynkixJR5Jc86gk1A1wz3NKp4wAhJZTqrPU=;
        b=mQLGwyp+5sPpaZ/Jd4HHCEuYzqkrVNNFf32bZhPEnLZEbCqDtp9rLqHHX0BOg30g+R
         wUQx2owF7BvRCdwxh1ensFNmJp9CMRSr8lAWXw0UGsy3FtefrGgQBAjtMTR4e/LHD9FC
         AC5uka4TTMHfLnlwLWXYTFrYMdRVEgMmuw5aKHBpDjNF3nTnL7iHndm0LdKQYL6/+Zd8
         YPxNIyP0+1Z+nBuRt7yeE+9xJKOTuRLDbdSKxGS9iEaBai5tJviu2tJduneo5epqy4sB
         K1BfYxBW1Z0ZrdyjK0BE1HKlVntH3DrXiyl4kBbNIXFDKyCj4b5oDt0d6fe2LFyzLEj6
         Hg1Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1794575027; x=1795179827;
        h=to:references:message-id:date:cc:in-reply-to:from:subject
         :mime-version:content-transfer-encoding:content-type:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=IW8bUyh5kynkixJR5Jc86gk1A1wz3NKp4wAhJZTqrPU=;
        b=V1q54IQ6UGKw093dHc0EmfrZHPqMKRVGWw5H6/rynOfPOgOn3bzyofC7Y0+7TTPZt0
         /ii5P4FRIGEspQ8FHBS+BhS0b9JHbqfQmyVN/JLCAXOZ9cPjh16o0Jt8ZJNxCx/P5CXy
         2dCG1dIHjGem+jA84HjZ3YTZBRcVsRK2uXJQbs1uEtmt4VJR8Zrhb/0IRGryZJkAKG/X
         33CdXO6FnWs/sEdQ4FIPDCSxmdcNGh5Gp51OnK0LRngnIYVvdgsr7MXYPn/lqcQpQFad
         g/ua6waQgzgT6mMTi++y+FRdcuy7nYg5LVfh9erXdWk+r22N8fW2vOxiOwuZZZm1ioyG
         +UOQ==
X-Gm-Message-State: APuU4Z80IUXpmaSw5JLQsDni8knqyTyARm12OP5EPU+yBC39pOKyfYuj
	KVVciRwMXbE4AYfmfNJ7WweC46th3RLPEjnGsr//3HP50SHyzeWLDiWR
X-Gm-Gg: AYBFou0htvVRnbJr7o9+OlDOzok2wFDTJdl5SEhdpHrPCNu0QrC32DGiREQRbgYZG2c
	lw+0nMDF8hC/VggqP0MR2v5B2SzVkcds/dhHVU/SWziiJOrVUARS9Q5Jx9d/TybgMfmIdWymsU+
	UmDZtvxllSYUEHnKk53KCUe0UeW8BNuM7K9/lwuEywpu86FPjzoZOV00UwNzO7r6wWO8sjRtnCt
	Eq++JGxR6udjmyXvWkXbD+76xTRpcSK+uReQOGY/q0S3rGu6wZdHpfZCsgoKaWXDRwdKoU0FbKW
	X1fYj5E7tI2w/sLTa2IJFFCLh2XeQKIQWqIsfyfquU8DW5RJxR5P9KTbTDr1j6f9TfD3AYa99Hy
	1rbg57jKT/SXLBghVdqsQVY4iZuqZ5vPrAEY5dRCIizXYDVWWZUydqMLU1J8BQ1KQZntV+d8DC1
	kON79Gp69aMgdiVwISgSYYmSnw01g75Dpwum2ip34bj7AqVJZJtq1qOdkPvhF4FYg71iDfZKrwD
	/IlK4REOPhqrbpD+GfXSPsShVIVpqwC7jDiMrsgGVbPozOacUULNGRyMjxl8i2dqnd8UIjd3moZ
	wOjhsCMJZdhco+3mpLnqdnE3DX309OuP3gVLMQEK/OjjG5MbefSDNyTl
X-Received: by 2002:a05:6102:6f08:b0:7d2:cdd6:6c8 with SMTP id ada2fe7eead31-7d64d7ed89cmr455276137.21.1794575026978;
        Fri, 13 Nov 2026 05:03:46 -0800 (PST)
X-Received: from smtpclient.apple ([204.48.95.220])
        by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-99c7794a699sm1276507241.1.2026.11.13.05.03.46
        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
        Fri, 13 Nov 2026 05:03:46 -0800 (PST)
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <0107772D-4F64-4F24-9E68-C6709AF264EA@gmail.com>
X-Cc: git@vger.kernel.org, Elijah Newren <newren@gmail.com>,
 Patrick Steinhardt <ps@pks.im>,
 Johannes Schindelin <Johannes.Schindelin@gmx.de>,
 phillip.wood123@gmail.com
X-Mailer: iPhone Mail (22C152)