From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F46F345CAE for ; Wed, 10 Jun 2026 17:02:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781110952; cv=none; b=nzZ8FNXm5cQMSJnOeLB+PyiEEFvD21FQwrh8oAOcehHPOO9LijnwTy0D0/mfwGcmpShK25TNGRC6u4rdZRNlPPsnuvA6/g7eMrzpkl2i651qiEssTk3bZOh0WVUV5DC4BveCltTJ6xwckpTVk0kRbjONiXIyvjGpxDFrEuuBmm0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781110952; c=relaxed/simple; bh=eKpjTLLNQre7xhpIFpKMu2LgW2RqEFliSCKeMcCIcW8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=r+awRb4J99Fhg/PfjE+KoCR4vP5y1NGjGXH0C0M9q2PiupRVW9T/Ll+TPKp/yvrP5e2pdI1kIMqFEPNZ9z9QuTxAtjezQ5ilelCKlV18k0R2YQLViWSwh9v6NHyVw2Detv1deTCe8Lp7pN+/NC6iXxSffoyARQQKbbXbb+Vu4KI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=OQH/q35F; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=PZDfOJjZ; arc=none smtp.client-ip=103.168.172.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="OQH/q35F"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="PZDfOJjZ" Received: from phl-compute-12.internal (phl-compute-12.internal [10.202.2.52]) by mailfhigh.phl.internal (Postfix) with ESMTP id 513BA1400077; Wed, 10 Jun 2026 13:02:29 -0400 (EDT) Received: from phl-frontend-01 ([10.202.2.160]) by phl-compute-12.internal (MEProxy); Wed, 10 Jun 2026 13:02:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1781110949; x=1781197349; bh=z49e8D1sMI C3w7wqH9FJRD52po09vM+iD8bXzpfGyko=; b=OQH/q35Fqt6B8PUVs9DTPR/c54 5tuA+hrpVCyquKO1c7syoY2vRJhft4T1Pbwf2RFIRNBPsYMV6OF2yZYg1DbJAOb+ utSOCjckthwQUR8ZdhYNUPNMV9KsMNH4Ki4d0tChGOpPyjer/5H6c2tK8AaWwfqa TK8NL8t86uPJUbVy9sV3+ThflkReRys2YKQfUSwfSaC2f4nkReFoSpjsgV6NTgSh LXh1plxDnSdA2Yp5wnK9MAy4bir3YLT5RxgjfdJl4jbXyFO0PNuCP7dCFj8OkqVv QveU8FrLcQSmgWys3XX1XGye7FWtm271rA8uJKCdaokZvpx5jPqnRdTdAiIg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1781110949; x=1781197349; bh=z49e8D1sMIC3w7wqH9F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d6a3ycg3QVjuYr6FXSQ X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 10 Jun 2026 13:02:28 -0400 (EDT) From: Junio C Hamano To: Toon Claes Cc: git@vger.kernel.org, Johannes Schindelin Subject: Re: [PATCH v2 3/3] replay: offer an option to linearize the commit topology In-Reply-To: <20260610-toon-git-replay-drop-merges-v2-3-5714a71c6d83@iotcl.com> (Toon Claes's message of "Wed, 10 Jun 2026 16:49:14 +0200") References: <20260610-toon-git-replay-drop-merges-v2-0-5714a71c6d83@iotcl.com> <20260610-toon-git-replay-drop-merges-v2-3-5714a71c6d83@iotcl.com> Date: Wed, 10 Jun 2026 10:02:27 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Toon Claes writes: > From: Johannes Schindelin > > One of the stated goals of git-replay(1) is to allow implementing the > git-rebase(1) functionality on the server side. > > The default mode of git-rebase(1) is to act as if `--no-rebase-merges` > was given. This mode drops merge commits instead of replaying them, and > linearizes the commit history into a sequence of the > regular (single-parent) commits. > > Add option `--linearize` to git-replay(1) to do the same. > > Co-authored-by: Toon Claes > Signed-off-by: Johannes Schindelin > Signed-off-by: Toon Claes > --- > Documentation/git-replay.adoc | 5 +++++ > builtin/replay.c | 4 ++++ > replay.c | 30 +++++++++++++++++++++++------- > replay.h | 5 +++++ > t/t3650-replay-basics.sh | 26 ++++++++++++++++++++++++++ > 5 files changed, 63 insertions(+), 7 deletions(-) > > @@ -430,12 +435,23 @@ int replay_revisions(struct rev_info *revs, > while ((commit = get_revision(revs))) { > const struct name_decoration *decoration; > > - if (commit->parents && commit->parents->next) > - die(_("replaying merge commits is not supported yet!")); > + if (commit->parents && commit->parents->next) { > + if (!opts->linearize) > + die(_("replaying merge commits is not supported yet!")); > + /* > + * When linearizing, a merge commit itself is not picked, > + * but refs that point to it might need updating. > + */ In the review response during the previous iteration, I commented that (1) the original excluded only merges, but (2) your version excluded both merges and the root commits the same way. Your response was: The way it was written in v1 was maybe a bit too smart and hard to follow. I agree with your suggestion and will adopt this (with some tweaks) in the next version. which I took as saying "it may be confusing, but it correctly expresses what we want to do", meaning "yes, roots and merges should be handled the same way". But the above no longer treats roots the same way as merges. I think that is intended, but just wanted to double check. > diff --git a/replay.h b/replay.h > index 1851a07705..07e6fdcca3 100644 > --- a/replay.h > +++ b/replay.h > @@ -62,6 +62,11 @@ struct replay_revisions_options { > * Defaults to REPLAY_EMPTY_COMMIT_DROP. > */ > enum replay_empty_commit_action empty; > + > + /* > + * Whether to linearize the commits (i.e. drop merge commits). > + */ > + int linearize; > }; OK. > diff --git a/t/t3650-replay-basics.sh b/t/t3650-replay-basics.sh > index 3353bc4a4d..64e0731188 100755 > --- a/t/t3650-replay-basics.sh > +++ b/t/t3650-replay-basics.sh > @@ -565,4 +565,30 @@ test_expect_success '--onto with --ref rejects multiple revision ranges' ' > test_grep "cannot be used with multiple revision ranges" err > ' > > +test_expect_success 'replay merge commit fails' ' > + echo "fatal: replaying merge commits is not supported yet!" >expect && > + test_must_fail git replay --ref-action=print --onto main I..P 2>actual && > + test_cmp expect actual > +' > + > +test_expect_success 'replay to rebase merge commit with --linearize' ' > + git replay --ref-action=print --linearize --onto main I..topic-with-merge >result && > + > + test_line_count = 1 result && > + > + git log --format=%s $(cut -f 3 -d " " result) >actual && > + test_write_lines O N J M L B A >expect && > + test_cmp expect actual > +' > + > +test_expect_success 'replay to rebase merge commit with --linearize down to root commit' ' > + git replay --ref-action=print --linearize --onto main A..topic-with-merge >result && As with other test pieces, this "git replay" command line is overly long and hides the important bit which is that the range being replayed is *not* actually down to the root, which is A (it excludes A). Intended? > + > + test_line_count = 1 result && > + > + git log --format=%s $(cut -f 3 -d " " result) >actual && > + test_write_lines O N J I M L B A >expect && > + test_cmp expect actual > +' > + > test_done Thanks.