🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #1604

[PATCH 3/3] sequencer: remove AUTO_MERGE at the end of a rebase

#1604
From: Phillip Wood
Date: Tue, 27 Oct 2026 10:57
93 lines
14310 bytes
From: Phillip Wood <phillip.wood@dunelm.org.uk>

If there are conflicts when picking a commit, the merge machinery
creates a ref called AUTO_MERGE that the user can use to compare their
conflict resolution to the conflicted result. The sequencer tries to
remove that ref on every iteration of the loop that picks commits,
but it is only written if we stop for conflicts, so it only needs
to be removed when we enter the loop, not on every iteration. The
ref is not removed after the loop has finished, which means that if
the last pick has conflicts it is left behind after the rebase has
finished. Fix this by removing the ref before the start of the loop
in pick_commits() as the last commit did for REBASE_HEAD. The tests
modified by the last commit are extended to check AUTO_MERGE as well.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
---
 sequencer.c                | 4 ++--
 t/t3403-rebase-skip.sh     | 2 ++
 t/t3407-rebase-abort.sh    | 2 ++
 t/t3418-rebase-continue.sh | 2 ++
 4 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/sequencer.c b/sequencer.c
index 2d6a5f525c7..7a88b6530bf 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -5181,6 +5181,8 @@ static int pick_commits(struct repository *r,
 	unlink(rebase_path_amend());
 	unlink(rebase_path_patch());
 	unlink(git_path_merge_labels(r));
+	refs_delete_ref(get_main_ref_store(r), "", "AUTO_MERGE", NULL,
+			REF_NO_DEREF);
 	refs_delete_ref(get_main_ref_store(r), "", "REBASE_HEAD", NULL,
 			REF_NO_DEREF);
 
@@ -5209,8 +5211,6 @@ static int pick_commits(struct repository *r,
 			}
 			unlink(rebase_path_author_script());
 			unlink(git_path_merge_head(r));
-			refs_delete_ref(get_main_ref_store(r), "", "AUTO_MERGE",
-					NULL, REF_NO_DEREF);
 
 			if (item->command == TODO_BREAK) {
 				if (!opts->verbose)
diff --git a/t/t3403-rebase-skip.sh b/t/t3403-rebase-skip.sh
index a2a5ac8ae01..d4fcfe567c4 100755
--- a/t/t3403-rebase-skip.sh
+++ b/t/t3403-rebase-skip.sh
@@ -100,8 +100,10 @@ test_debug 'gitk --all & sleep 1'
 test_expect_success 'skipping final pick removes REBASE_HEAD & .git/MERGE_MSG' '
 	test_must_fail git rebase --onto hello reverted-goodbye^ \
 		reverted-goodbye &&
+	git show-ref --verify AUTO_MERGE &&
 	test_cmp_rev reverted-goodbye REBASE_HEAD &&
 	git rebase --skip &&
+	test_ref_missing AUTO_MERGE &&
 	test_ref_missing REBASE_HEAD &&
 	test_path_is_missing .git/MERGE_MSG
 '
diff --git a/t/t3407-rebase-abort.sh b/t/t3407-rebase-abort.sh
index 1703b5ae9b5..fdd9a2b9f61 100755
--- a/t/t3407-rebase-abort.sh
+++ b/t/t3407-rebase-abort.sh
@@ -35,8 +35,10 @@ testrebase() {
 		git reset --hard pre-rebase &&
 		test_must_fail git rebase$type main &&
 		test_path_is_dir "$state_dir" &&
+		git show-ref --verify AUTO_MERGE &&
 		test_cmp_rev d REBASE_HEAD &&
 		git rebase --abort &&
+		test_ref_missing AUTO_MERGE &&
 		test_ref_missing REBASE_HEAD &&
 		check_head &&
 		test_path_is_missing "$state_dir"
diff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh
index f35cd130921..1c26bf5de54 100755
--- a/t/t3418-rebase-continue.sh
+++ b/t/t3418-rebase-continue.sh
@@ -39,9 +39,11 @@ test_expect_success 'merge based rebase --continue removes .git/MERGE_MSG' '
 	test_must_fail git rebase --onto main HEAD^ &&
 	git read-tree --reset -u HEAD &&
 	test_path_is_file .git/MERGE_MSG &&
+	git show-ref --verify AUTO_MERGE &&
 	test_cmp_rev commit-new-file-F2-on-topic-branch REBASE_HEAD &&
 	git rebase --continue &&
 	test_path_is_missing .git/MERGE_MSG &&
+	test_ref_missing AUTO_MERGE &&
 	test_ref_missing REBASE_HEAD
 '
 
-- 
2.56.0.336.g97505d19352
Technical Details
Message-ID: <2fcb42a0858dffe45241cbced066dd0c0f5da76f.1793098652.git.phillip.wood@dunelm.org.uk>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-73467-linux-kernel-git=dewy.ru
References: <cover.1793098652.git.phillip.wood@dunelm.org.uk>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-73467-linux-kernel-git=dewy.ru
From: phillip.wood123@gmail.com (Phillip Wood)
Newsgroups: linux.kernel.git
Subject: [PATCH 3/3] sequencer: remove AUTO_MERGE at the end of a rebase
Date: Tue, 27 Oct 2026 10:57:57 +0000
Organization: Usenet Network
Message-ID: <2fcb42a0858dffe45241cbced066dd0c0f5da76f.1793098652.git.phillip.wood@dunelm.org.uk>
References: <cover.1793098652.git.phillip.wood@dunelm.org.uk>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1518275"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:1Xj8M2mVrWr+g9HmjtoYM4srlIQ= sha256:hAyxaGRoOsGrKGc/VXZgA0tBl01SWg9mQ2Xh+Axs6pc=
	sha1:YVvbrAjQ663ESf25z5YyiaQbjos= sha256:BDVPnbLIBHTnvMxvzgEUc/Ka/1rvN+grrc+wYNyYM7c=
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 70A4E125BEB; Tue, 27 Oct 2026 14:02:04 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 tagged_above=-9999 required=6.31
	tests=[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.25,
	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 lggplRHzC29G;
	Tue, 27 Oct 2026 14:02:02 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-73467-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id A4697125BE8; Tue, 27 Oct 2026 14:01:53 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id B054D2BC79; Tue, 27 Oct 2026 10:58:25 +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=1793098705;
	b=vbKI8uc9p7VCzAL2iGPqkkp/QmnawRVFB4WTXo4iC5+xHDUtMJKd8SaGAwsS4gO+Bfyb
	 MLXxeM2fuZpIzS08YJJAt2DwtaSrqopWPTL4poVEt2zGom/+KsX4ECzi82LFCg68XRGIa
	 qiT8ccA//3QwhKpM//ytqkmoJz3DMErc0UotNIXGCkoUY9lp7na6NpT4SHdh/o73hGIne
	 bwuAp1HE2eVvt3fCkL/PnLFZMD4C0bDVEhvOYbqCXqTQnBvzUfn7hXKvNKc0D4ZDCB1+Z
	 VRXlyd5L0bdX/7rndbd0yR1a1ywl2Fh9p6lOGclsxnY3jQS00of+gTgd14ATEmmUyqw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793098705;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:
	 References:Reply-To:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=YkinI9rsc9iGEZV1cYm1XSqF4Bvk5zujqWqV6NcseSw=;
	b=r2cOduNtmlt7OJUhJ82ZbGCmmYA0RIvkg12BuHWs3DpKENgoLz9MxQWtwNXAJxsA+G16
	 ZzOJ9Zibh7jHwEg+TnVVs7ONc4RxXfuKvc0tjZvGUNFDmrsc/P3Wb+TnqFNYlD991yP91
	 nLGSiKij50v2XBPlQooZzcUSFPeWD0jj+x2sI+MMwLdYQEuJOTXwK1PC3p/gul3iHJLta
	 aXZ61MRyX2FMm/3uOqfWAGjGPEXZy2tqZes8BGIXFVdNKLTGejVUCihr9Z8JRIGTSnOza
	 Jx0MwiN1cH+P+iGtnTZiEsieRER/cr0cA3KeVYut24ja8VysuGmgFfroTeFBapVsrQg==
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=20251104 header.b=hpWKGyyX;
	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 59FAA606A329;
	Tue, 27 Oct 2026 10:58:25 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=hpWKGyyX
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.52
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793098699;
	b=hdrmYJ85osQoBvBKBt/wON26yjp/LK1x6ucQcnKSqLZnTNgyq2rUu8J3EpursMzh61lf
	 TiYRyOa8Ml3cIQnPc0T/Zdpps36CyBgFQJDI8aVnCmEaEgtn0STbd+QNJNLNtAov5X9ah
	 apHJNTCZwSVdZy5giM3e4SmrDIWp7RMXjACzhFXJDdb37uGpLfEIyzLYTz57igxFXG0wR
	 v8wtNX93n0mEhgnyduvt47PC/vgT+O5IAAmw88NdMbl6mh7AwmknJXmTCgya9QoshW1XP
	 ok8IYV2ZS8E3q0kt2qqSJrgJlfqtQLvMZk+olceNuT7v5UnTCD1H2Xo1kBw2XUI/HFQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793098699;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:In-Reply-To:References:Reply-To:MIME-Version:
	 Content-Transfer-Encoding;
	bh=YkinI9rsc9iGEZV1cYm1XSqF4Bvk5zujqWqV6NcseSw=;
	b=RSO6FUye4ZrOKmIbxAd1Y3OYXfMF86CR+G2gNFSsxukRZC8fCb1h7tKoJKGHulJ+xGTO
	 DLRt8uqa4dAHFP27mCiXD1IP86SATmJx39uIrfr7VjQCyFC3yhQHglON80bifBiPApYAb
	 Tr/qm2F8tmyDiM0hOkyUz5rtyD3pRBMkvZswdKTjpbAHe1z2zFZgYrd7fUoS8D+5EzNfI
	 J0EU/lBzogQc0HcaE1Ygs/FQChKUjyl5LH1WKqOfHQgoTDR5w04P3pIMHiT2WwmGSKxtu
	 8/9DamjCJd5/gVrM/66ZgSCUGCvKjb3ZlKQYxH35Kw2sKtMZxK/RR07eJScL2qFYmNg==
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=20251104 header.b=hpWKGyyX;
	arc=none smtp.remote-ip=209.85.128.52
X-Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.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 29D77606A327
	for <git@vger.kernel.org>; Tue, 27 Oct 2026 10:58:19 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 29D77606A327
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-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4956869750eso26745775e9.2
        for <git@vger.kernel.org>; Tue, 27 Oct 2026 03:58:18 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20251104; t=1793098697; x=1793703497; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:reply-to:references
         :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject
         :date:message-id:reply-to:content-type;
        bh=YkinI9rsc9iGEZV1cYm1XSqF4Bvk5zujqWqV6NcseSw=;
        b=hpWKGyyXfOL1/lXc1BxD0n+EGZcfQBifbZ24XMC0IISmjCnwgsyrNe/SLzbd77tCV7
         N4E1rj3T3iY+36GAJdvurmfD6/5I4q+RxRnLl/kDRK48MWfFhwtsRZzjaduhbgqDCc0R
         tDxguJPCwWHbzacjzVBIpz2Scxu3RRsnY/Fh8wOY7/+qEQbBVl385wpvjwK4ict5/hIr
         Zbj2j/XxYGTw2WOds7oWu7Vlya7ONxzT5Jf2cloZvlS9oGOETDhvT/SYNNq8mTiu51k4
         cjyu6pcl5pD/3APG8MUl2sTHcqAt9epYTohe/dO8xlzoWX48ILETGXLNe3MeqTGiXpqR
         /QsA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1793098697; x=1793703497;
        h=content-transfer-encoding:mime-version:reply-to:references
         :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=YkinI9rsc9iGEZV1cYm1XSqF4Bvk5zujqWqV6NcseSw=;
        b=xe2rjke3JNBWYR4U22u5lUfw2jlsV3L10cIGYKbCAXMBSE19zalGq/LzFSPPuwi3Ox
         PlHBWBd1d63U1LaZEPCcWGvTe4SCUVFZVOASx0JmrEvbabihgMMgbHkWHq9BLZ5FUoOo
         4fFr+tAguE/WoT5ksB8TASEpq5YH5xs8BhlaHHPBUtcj3wS+qMSLxTV3/72C/VwuvVlf
         d4P1SwxdXk7T52XG64cxscVHBhydZV2vY0Afru1DbUFiGBvaIznP9+yqbnVe4wAiNGyL
         cevZXg+Cs3/RRgVBNsU4ti2J6iI47jq13w4JTh5UHUZaaQ4bIOvUfdhHf0j92eduVrro
         fpJQ==
X-Gm-Message-State: AFq9FYIqJFiUM5EJ2kcXzAXb0pCfZ+GesJd2sLdTelA0n+9bAxfyNUFt
	64crWbRkUw98i7JB1KjMd87ewTZMmGTYgrVt8unhQ1RIbR3y+X7hPK6hfk12sw==
X-Gm-Gg: AYBFou3mUHrCYUB+LLQ82gyGDR3HmbHwobVLSGMskZ5CYyEndmhzVntyRDWAGlVws+c
	1LUm5jNgUwzginRE/fb6JcBQIp3AsDbOOxej+ELwiwphtXAMGMzI1WThjQi2q5vHtmCMsoH25a/
	LMU//yeaDEOv+ST9LOWXPk3DRGaXNhPWoZCfiz5JaLaGqgBpw8jZ0ma+9LLP/mkNzz4+44aMgIK
	Moqkh8F9wuYnxYdfyejM8xWnS2uVa8ebXzIegnWV7nMYuwP6W1iVrHEcz6XT89d6iYjJ7me8BSV
	q4TsHEDwltHzoo5dLm7NfOgD8L/BMzWvKneULQTVcTciPdc3nq+fWprZ3XwgKCSV+1sZlB+eHQh
	zn+g7BQ0ot6PCPyARYGKiP0mh1NLDs7YNNoBvYqyZJ8KGKY83lDOZ/6Sh5Tui7E0Nqs1bzWSiyd
	jwvu6AUGLKo6vmmewL0js++gtH5Z0do2naa3YxnhAWP1zQBAJIsVzdV5Z8hLalrlEax1jNIyUbP
	Y9ThZfovWuBE0+ZChPIpyXYqKJIykNoESxqOEOKA+sAdOwa91LHY6JyBdkpOm5AsYq9eC92xC9t
	pP5T
X-Received: by 2002:a05:600c:1c2a:b0:4a1:dfaf:f465 with SMTP id 5b1f17b1804b1-4a35ac3a7d9mr227508565e9.4.1793098697438;
        Tue, 27 Oct 2026 03:58:17 -0700 (PDT)
X-Received: from berwick ([2a0a:ef40:724:6601:f3ff:aebc:61f8:d91f])
        by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a35a0aa0bcsm321638925e9.4.2026.10.27.03.58.16
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Tue, 27 Oct 2026 03:58:16 -0700 (PDT)
X-Cc: Long 76 <long76.git@mail.ru>,
	Matt Hunter <m@lfurio.us>,
	Phillip Wood <phillip.wood123@gmail.com>
X-Mailer: git-send-email 2.56.0.336.g97505d19352
X-In-Reply-To: <cover.1793098652.git.phillip.wood@dunelm.org.uk>
X-Reply-To: Phillip Wood <phillip.wood@dunelm.org.uk>
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