🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #3448

[PATCH v9 1/4] branch: move the deleteMerged opt-out check into a helper

#3448
From: "Harald Nordgren via GitGitGadge...
Date: Fri, 20 Nov 2026 14:24
74 lines
13387 bytes
From: Harald Nordgren <haraldnordgren@gmail.com>

A later commit adds "git branch --delete-integrated", which deletes
branches whose tips are not reachable from their upstream. Those must
honor branch.<name>.deleteMerged=false as well. Move the check into a
helper so it can be used in both places.

No change in behavior.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
---
 builtin/branch.c | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index b536b619bb..2c1a8b8395 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -824,6 +824,23 @@ static int branch_pushes_to_upstream(struct branch *branch,
 	return ret;
 }
 
+static bool branch_opted_out(struct strbuf *key, const char *branch_name,
+			     unsigned int flags)
+{
+	int opt_out;
+
+	strbuf_reset(key);
+	strbuf_addf(key, "branch.%s.deletemerged", branch_name);
+	if (repo_config_get_bool(the_repository, key->buf, &opt_out) ||
+	    opt_out)
+		return false;
+	if (!(flags & DELETE_BRANCH_QUIET))
+		fprintf(stderr,
+			_("Skipping '%s' (branch.%s.deleteMerged is false)\n"),
+			branch_name, branch_name);
+	return true;
+}
+
 static int delete_merged_branches(const struct strvec *upstreams,
 				 const char **argv, unsigned int flags)
 {
@@ -852,7 +869,6 @@ static int delete_merged_branches(const struct strvec *upstreams,
 		const char *branch_name;
 		struct branch *branch;
 		const char *upstream_refname;
-		int opt_out;
 
 		if (!skip_prefix(branch_refname, "refs/heads/", &branch_name))
 			BUG("filter returned non-branch ref '%s'", branch_refname);
@@ -870,18 +886,8 @@ static int delete_merged_branches(const struct strvec *upstreams,
 					FILTER_REFS_BRANCHES, DELETE_BRANCH_SKIP_UNMERGED))
 			continue;
 
-		strbuf_reset(&key);
-		strbuf_addf(&key, "branch.%s.deletemerged", branch_name);
-		if (!repo_config_get_bool(the_repository, key.buf, &opt_out) &&
-		    !opt_out) {
-			if (!(flags & DELETE_BRANCH_QUIET))
-				fprintf(stderr,
-					_("Skipping '%s' (branch.%s.deleteMerged is false)\n"),
-					branch_name, branch_name);
-			continue;
-		}
-
-		strset_add(&deletable_branch_names, branch_name);
+		if (!branch_opted_out(&key, branch_name, flags))
+			strset_add(&deletable_branch_names, branch_name);
 	}
 
 	protect_stacked_branch_bases(refs, &deletable_branch_names,
-- 
gitgitgadget
Technical Details
Message-ID: <37ef7636e069ce528728c43cd79f678293e0d035.1795184664.git.gitgitgadget@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-75928-linux-kernel-git=dewy.ru
References: <pull.2425.git.git.1790667030497.gitgitgadget@gmail.com> <pull.2425.v9.git.git.1795184664.gitgitgadget@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-75928-linux-kernel-git=dewy.ru
From: gitgitgadget@gmail.com ("Harald Nordgren via GitGitGadget")
Newsgroups: linux.kernel.git
Subject: [PATCH v9 1/4] branch: move the deleteMerged opt-out check into a
 helper
Date: Fri, 20 Nov 2026 14:24:21 +0000
Organization: Usenet Network
Message-ID: <37ef7636e069ce528728c43cd79f678293e0d035.1795184664.git.gitgitgadget@gmail.com>
References: <pull.2425.git.git.1790667030497.gitgitgadget@gmail.com>
	<pull.2425.v9.git.git.1795184664.gitgitgadget@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3178965"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:o0GSwHALoCt0KMBzpbusQh4qKsg= sha256:YMkCVzPeOUvtlozME1+8j2DW8tN6DyTMH8Zo1d+I39c=
	sha1:NnPvjSWJcAvEse5nAxpOZp1M110= sha256:AQXGCeb1cF65RW1qffwJKzr+EpH65BJLbBlcpbAk598=
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 E97771159BD; Fri, 20 Nov 2026 17:24:45 +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 MyCbFlBIm6T3;
	Fri, 20 Nov 2026 17:24:43 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-75928-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 ADA511159B7; Fri, 20 Nov 2026 17:24:33 +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 6D0CB203A95; Fri, 20 Nov 2026 14:24:31 +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=1795184671;
	b=kgAtI8Fr3L5hbmzPD/ltOqpNzfBBlCLh5NtuzeAGEZoK3BAGJNYL0g/wbALYoGBHD5+H
	 +4O51pF+8a0WFdlrCRKM7yTqW3f15TLz2RokWOPsFaVY1X/99F+rHBUORLDTxL2+881x5
	 PYoe7TYCbrS5Xazflqr2hnyLlr1zW6vPC2zUgdhPtM53mRTS05hiJr6aIDo3+vG9B8bGw
	 AphyOfE+2hX3njres03ydVh4TKNG3Wq1+gUyvu99OWUcMOADFY0WUH5vserbkUGsPTWUU
	 DtRNr7Wn78pkBiBMC72zxO23c36zDlXs7dpZZJadfm7WBk/XNl52I8Egwt/Yp01xNGQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795184671;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:Message-Id:In-Reply-To:References:From:Date:Subject:Fcc:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:To:Cc;
	bh=t+sWMCsL8awzinjVBKiIODQDcX4FxHb7TINpwMWSWbo=;
	b=gaDeOg7/Y1KQwOR0KQxlyd9TFykRj8CfNWrUadXUwLE4E/S8+GgPGPFpbbSb/0vBiL+4
	 WPo0V0uAw1B2n46k68FUigjSlY7qhdUO17M7T7IdTPIWPSAU2wwNjfW6LwOGsbaR568K3
	 RTYlyQ5DwPeLIZLztgzR3VqWP8x6bL+HT1BwckvCHYaeNg3aSJZeVgFYm3YT1FEMJtdTx
	 b6ElVypSBg0sTL7OjGxxiyDhGzBf+WohxpPzYwxOJYMfRuQOF7NWtFjhRWnIy72yNL2LH
	 xwnZvlf2rID/rLkNdpjU6tV0J6RIkBRF4yuWIwyCxsPlEAyypqPGas3O9CUQFvclFPw==
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=fd6gLdj9;
	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 2191B606A325;
	Fri, 20 Nov 2026 14:24:31 +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=fd6gLdj9
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.44
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795184670;
	b=DgoWL1gH6dUB18xSmXwF5G6f2++tVO/S8Eaa1PjUGJt7RGW5mM75WHJE5OrBrHKE3TEp
	 Krio4ph1zy6MOCrp2zZrYEgxvFQkQ1Ebr9OuFqjUsj312w4GvWLs1P9TTbepBaDcjU8AO
	 gpfKZcEmOsk8IkX4dVVT/RhRxvs1SWqKeRzE+Q1LniHDa2di/f3l4SAIlti2Rj0+C6gbb
	 XzQHnKSB8lqShrHlxeNGe/LNR9b70TljVV2IEeGijB7YwEULQF9N4mPKh4NVQPwvKfEhs
	 sbSWwe45/VQbVldndn/GLF+8kE6DWod/KgAQlz4FEptzfRiByHs2q3ewmBxloHNuWYA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795184670;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Message-Id:In-Reply-To:
	 References:From:Date:Subject:Fcc:Content-Type:
	 Content-Transfer-Encoding:MIME-Version:To:Cc;
	bh=t+sWMCsL8awzinjVBKiIODQDcX4FxHb7TINpwMWSWbo=;
	b=QgfOn49Q69OeXJBYm/Xtr0YPxZUC4hW+CiK/927hDUY7ncZM3HqcHcEafbXxiF910EpZ
	 vcyRPP4JjUSUtgYwlrflIs+IduoEYK48UzOivmti4RvafJMHpdUn2AWCtSWmY5h/5dSne
	 cKPh3vAPsHQX16BFuAAhuFsWYAobL0/cBCHH8pBoyUb4sLfciP8D2+88bT8Q5xD8Ker/L
	 jXCMQp9jjsieZPNqxH4kQLfkq+82XNeNFnkrEqSS33ClQAMG8HtPPj6tcFVSBYHdl4+SS
	 uQ7wa+UhlgpdmDqXYyyDk38UvFGmuzo/kEuH+fC3SOpUSThbYJ9RV4Ee0i/FrUCoP8Q==
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=fd6gLdj9;
	arc=none smtp.remote-ip=74.125.82.44
X-Received: from mail-dl1-f44.google.com (mail-dl1-f44.google.com [74.125.82.44])
	(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 EBBD4606A336
	for <git@vger.kernel.org>; Fri, 20 Nov 2026 14:24:29 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EBBD4606A336
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-dl1-f44.google.com with SMTP id a92af1059eb24-15dd124bbe7so2045500c88.1
        for <git@vger.kernel.org>; Fri, 20 Nov 2026 06:24:29 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1795184669; x=1795789469; darn=vger.kernel.org;
        h=cc:to:mime-version:content-transfer-encoding:content-type:fcc
         :subject:date:from:references:in-reply-to:message-id:from:to:cc
         :subject:date:message-id:reply-to:content-type;
        bh=t+sWMCsL8awzinjVBKiIODQDcX4FxHb7TINpwMWSWbo=;
        b=fd6gLdj9SEyGYURxw23diigzOgQ8hxQMF5hGh0yTA525oq2xTxjdfgmVG7r7djJPvo
         Xmih5C76+aLugJ2pOTfcmd2ZjroMWLlyR9gYlklGN/hMdkdNIHA0cOWT0ehoVYf2+Jxj
         crnW+Rent3cMH64L5DB774SvINTKEa1+YL4Clmu9AQ2ghTn7AKiFOV09HA3oLErev+qI
         ccnXN6JuCfFqCdlXQxh4dDcEVBqfky36BrBMUbnzpAv40lzpY9icwLPgWXrC/NaePruj
         QqlgWiogagDd18RfjL2zlmMKtCDNoujL/qsz6vdtVxOBzlVSEk0+GLj41ZVgkhOgk2Sb
         YjrQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1795184669; x=1795789469;
        h=cc:to:mime-version:content-transfer-encoding:content-type:fcc
         :subject:date:from:references:in-reply-to:message-id:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=t+sWMCsL8awzinjVBKiIODQDcX4FxHb7TINpwMWSWbo=;
        b=O+xkzcJ0PrtsNXE0/Ya9VbtGxP0TH4AFh+VDJBld0Ztr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FHiA90kLMMzbBImT2o+IMZQ==
X-Received: by 2002:a05:7022:e80e:b0:1ab:de8b:5f0f with SMTP id a92af1059eb24-1b556924b07mr3332404c88.40.1795184668974;
        Fri, 20 Nov 2026 06:24:28 -0800 (PST)
X-Received: from [127.0.0.1] ([20.171.3.187])
        by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b5567e495bsm10512974c88.4.2026.11.20.06.24.28
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Fri, 20 Nov 2026 06:24:28 -0800 (PST)
X-In-Reply-To: <pull.2425.v9.git.git.1795184664.gitgitgadget@gmail.com>
X-Fcc: Sent
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-Cc: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>,
    "D. Ben Knoble" <ben.knoble@gmail.com>,
    Phillip Wood <phillip.wood123@gmail.com>,
    Jasper Mayone <me@jaspermayone.com>,
    Tuomas Ahola <taahol@utu.fi>,
    Harald Nordgren <haraldnordgren@gmail.com>,
    Harald Nordgren <haraldnordgren@gmail.com>