🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #1034

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

#1034
From: "Harald Nordgren via GitGitGadge...
Date: Wed, 21 Oct 2026 12:28
74 lines
13291 bytes
From: Harald Nordgren <haraldnordgren@gmail.com>

The next commit lets "git branch --delete-merged" delete branches whose
tips are not reachable from their upstream, and 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 a613148fc7..171b13b081 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: <82413e5cd762f342358525cd7891ef3c5fa1a8e0.1792585717.git.gitgitgadget@gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-72718-linux-kernel-git=dewy.ru
References: <pull.2425.git.git.1790667030497.gitgitgadget@gmail.com> <pull.2425.v3.git.git.1792585717.gitgitgadget@gmail.com>

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-72718-linux-kernel-git=dewy.ru
From: gitgitgadget@gmail.com ("Harald Nordgren via GitGitGadget")
Newsgroups: linux.kernel.git
Subject: [PATCH v3 1/3] branch: move the deleteMerged opt-out check into a
 helper
Date: Wed, 21 Oct 2026 12:28:35 +0000
Organization: Usenet Network
Message-ID: <82413e5cd762f342358525cd7891ef3c5fa1a8e0.1792585717.git.gitgitgadget@gmail.com>
References: <pull.2425.git.git.1790667030497.gitgitgadget@gmail.com>
	<pull.2425.v3.git.git.1792585717.gitgitgadget@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="4137781"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:WK14CvmRvIRsSk1Revix9svjbZw= sha256:4QqKBYmkFA3wREeR0y/rOzqvYcGtiimJu8UehkGdR2A=
	sha1:cG74xI8gHIX2yIvlF0DBrdU/AW4= sha256:8ev71AiaLAf1x3fDEJmzXXDdA9kKKdJvasrsit88e8I=
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 E97B8110FF9; Wed, 21 Oct 2026 15:30:18 +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 ohsZBB8w-WYa;
	Wed, 21 Oct 2026 15:30:11 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-72718-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 46525110FF3; Wed, 21 Oct 2026 15:30:02 +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 4432C4318D; Wed, 21 Oct 2026 12:28:49 +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=1792585728;
	b=EtceoJoJ02oIvGzq9ibDFjD/xisP3xe3WqLU2mna1LNM8Sr6KGNUkn4F58wIFT7NExUD
	 SJTXeYMORx/pgjOxT7LQZJxd4YAuunGUen92DicGbOIiP2PDK73wKLLs7c/WyDLcC89CR
	 sGyV3dWXxoqHLDd1VGHmI9y+CEgcUc39Thv6QwZs280xw1uEG0qJGRQocd2szBtHoDnjd
	 dZHyEArMN06Ob92dxoGYlYQITB/qqA81WDHD09l59Po+svWAD2wyxep1lJxQgn/62wmZV
	 wKiZJ+TIuVZyKvFy4/X4slEM/pxeB/hRB8GF3pe0I+PUQ3TdyUrkmtxu/h69CDv1xrw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792585728;
	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=QRFcRxPULqUWnAu6HC1bWaLibSrUBxcKp0LMmu8cKlQ=;
	b=i4MtkC8zXL2oxsRDru6w1w9DDoX9Q0iqGbRJWa8krgfY+2aLehMHyh6igtxUZFrMGZTN
	 paMSd3s8biOj36PtJg/cRDToJcxBtK2+lG9+NYcE73r57ckvDo1r6jVrcGZA/pd5VGJS9
	 OlUjEKXA4rruB7JuQv/x0HavDxB+IJoEdL2nq5UqAzGjN2hTaCSz4kvn0vIJwHEYOgpPI
	 NNEjDdjJDUSoiL5/XU5uzBKWo30+kLUy5UBK/U0LB1553V3KtAAig8fE1cPEBVLmQpiJi
	 dD5Q5YUL53HSyq4EyPZO1hL7g/108NfvanBLhuaMxN362iJt6jpijLl7UuL7Pb3Z2TA==
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=MGgzRElr;
	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 31DB8606A320;
	Wed, 21 Oct 2026 12:28:48 +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=MGgzRElr
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.182
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792585722;
	b=i6J5rCnK+Xs8q86LWZZKWo0SR469Fv41lzLpq9ao/b1MpzXtfFhaoZn2SAo+0L+yAN/I
	 w1AqNBxko4evC8se4S9kndRgYh1NDXThGSnQmn8ago7I1EjxXvvdZc/hH2fTLyKIg1ZXY
	 VNz/Q0DlTFyNJQQeNgjbNNxoUVBhQPDW1FXyX47ZxmxRr4d6/rqXwIyhuEwsG+K91Y7Gp
	 i+MZwJu2uyyXdN8HchTMTPH/A47IRMp/0O2lok4WRxdB/6rMulUSPchef2TkFHPOOg/uB
	 vSCFOQO5o7i9vkPrGfc2JQ1wZvo3wmETMhuAYV2TNPuHU4rkG7T4+XM+TZftFGOVqVg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792585722;
	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=QRFcRxPULqUWnAu6HC1bWaLibSrUBxcKp0LMmu8cKlQ=;
	b=lZh8ZiOkEtJ9QuHdYMJ4Zn99xQpNekKjUqZwkfHOd1be6YgJxbk0K9gZwpYXX1A9tz2j
	 OdoebcqVOeNxkAxkj2dsN1ELSxcPH2sZE1PIZ0F1BrfyWCGaBS80uYF0vsxo+/Px8L4Ho
	 UumU5yTk0n6S56kEhPb/y+CdQ1wIKdu99uAbjCoIVp4aese1WyQYX0PlIkFfuI/m2TUBa
	 s5dRIH1y0soO5njaaZPF0TBqDz5Iu2aL7HeCMCnZZrAVYlzD5fujuCI3mCQ/3frr/qbl6
	 J745tJ/84s5k2YqG9XM9md3BVN2FCP7Y95PovwJfY3pr/njIZbK8NR0re+joNyTcS0w==
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=MGgzRElr;
	arc=none smtp.remote-ip=209.85.160.182
X-Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182])
	(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 EEBDA606A31E
	for <git@vger.kernel.org>; Wed, 21 Oct 2026 12:28:41 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EEBDA606A31E
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-qt1-f182.google.com with SMTP id d75a77b69052e-53664b4860bso7033561cf.1
        for <git@vger.kernel.org>; Wed, 21 Oct 2026 05:28:41 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20251104; t=1792585721; x=1793190521; 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=QRFcRxPULqUWnAu6HC1bWaLibSrUBxcKp0LMmu8cKlQ=;
        b=MGgzRElrgNTuh5e7TWUxK+f10qMDwHg4MTUqKdIKSRouvg5uG/HKeQThiQLLWij0Ub
         PpfP2BX6lC3pPoURka548gThWDSjxPWnUbpA5/BBA4g/ms2/VUUvCH/imhTpaPZ1QAQF
         hPbHIg4GS0qdOIgHkdf1y2SiLzjbM29Fl14OKvkK+OgaaC+8VGnhZmlio8u/LOztEaK0
         txUSuEshU8zufva8JtgxyUILE0DuIGGn62MPiVvMy4rQKGnatChHBjgew0bhpldNEwzi
         a511BFvcINvj62NiPw84hwLPY8BDcbZymbQCu8EsZMDPG8nElveaAfrxrN6tiMC8ruOL
         eV9Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1792585721; x=1793190521;
        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=QRFcRxPULqUWnAu6HC1bWaLibSrUBxcKp0LMmu8cKlQ=;
        b=yxZvbRfcPbFXFyFpdp5XADCsZnmDIqH3doeambKJCnH/NSX+2vxkizLTjmhFDj6hjE
         AeSYibDree8Nvksoh/7mxo8efkizbPEi20pHaiuDaxLlOB0wcFus6tHRCDS110kq8nQA
         aXqHFC9EJlzdgVG5AJSbVN+FMTidUPpjdKSQy+4Yt1wyeIOlKDlLwfu0By6m7IY2diA5
         oc/MwHgPNfWokgloXO6YyMHSOCrRX38JrV3Us9FvWqJRUJsdbWbk2yPqIvnajwvgQLeg
         O6vwsnWSa02M5S6tbLgWN44jqzwKzJ8H7no036Ly/2bdSXqNNyfdMAgkKH/ptzSLKqEt
         qlLA==
X-Gm-Message-State: AFq9FYKJxZs+0GVkfiys0c6I4tAWYF1lhdM8tqqjgDoPhwRc7VnSKI6d
	DUtlM6ZrUiFPtUat/r3n0GAx9gcJnG7JGZZnho4HuGuIHvmRIzvqgWVkThmv98Aw
X-Gm-Gg: AYBFou0hPQtfESHVGKTnHyzlkKqCpQzgJKheQtrQSFG+M2LabPRY/YSPKf/QcigDGpL
	pPle6dkS8wZPat7H8yXnly2Pcjh2ubW8fnrSxTmDadNM30w+CrGWMWwn6ZIj+68BueaGjfoYF0n
	6rZlbRzwHseVHAGUqxAL/vtq98HknClB/ozy7jC7Ih5n+KHFsYy3SVWJr/O3egMeq7DVKQPS0Ri
	ZMku3MSfF2x6Rquinxo2ZpHszP544VMTL293WkEg2EZejvFT3KNXSo6n2VteIRHt1KTlbHIsSlY
	SBvP7WsxFLtofMvIBUEzxdfLsvTPQonB6AyhAtxXoT0p+qMF4Z3/WOgrwudX5Cg/ffOhxbsNOPp
	F0OeM5EKK0eeE9e3fWzba0XpACgQYDHWoyWFD/AokFfoHryUCL7AcO/qGNV43VBLbpK+GdG4IuS
	D3BJeaYQFKdK45glFqLa0Uz7h6tOPcbIiIdIguu+nCqUjVaGf4d3t1DID+tJJRJNZRYkM3Un+eH
	5lp18UaBm3lojGO4nPPPbDrd0YZDi+jgobG2/DvFt4JJRnvTtUKnLn2An4=
X-Received: by 2002:a05:622a:1482:b0:536:55c7:a1d7 with SMTP id d75a77b69052e-5369b7ceb9fmr28957521cf.54.1792585720668;
        Wed, 21 Oct 2026 05:28:40 -0700 (PDT)
X-Received: from [127.0.0.1] ([20.115.95.136])
        by smtp.gmail.com with ESMTPSA id d75a77b69052e-53698bd5b4fsm18427841cf.26.2026.10.21.05.28.39
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Wed, 21 Oct 2026 05:28:40 -0700 (PDT)
X-In-Reply-To: <pull.2425.v3.git.git.1792585717.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>,
    Harald Nordgren <haraldnordgren@gmail.com>,
    Harald Nordgren <haraldnordgren@gmail.com>