🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #3977

Re: [PATCH v2] var: add GIT_COMMENT_STRING

#3977
From: Phillip Wood
Date: Fri, 27 Nov 2026 16:42
88 lines
13954 bytes
On 26/11/2026 20:56, Junio C Hamano wrote:
> Phillip Wood <phillip.wood123@gmail.com> writes:
> 
>> what the comment string is because they need to do something like
>>
>>      {
>>          echo ' #'
>>          git config --get-regex '^core.comment(char|string)$'
>>      } | sed -n '$s/^[^ ] //p'
> 
> Did you mean
> 
> 	sed -n '$s/^[^ ]* //p'
> 
> to catch both " #" (the fallback) and "core.commentstring //"?

Well spotted (though I did say "something like" :-/)

>> diff --git a/Documentation/config/core.adoc b/Documentation/config/core.adoc
>> index bdc74d291cc..e348d8895d1 100644
>> --- a/Documentation/config/core.adoc
>> +++ b/Documentation/config/core.adoc
>> @@ -549,7 +549,8 @@ core.commentString::
>>   	Commands such as `commit` and `tag` that let you edit
>>   	messages consider a line that begins with this character
>>   	commented, and removes them after the editor returns
>> -	(default '#').
>> +	(default '#'). Scripts can query the comment string with
>> +	"`git var GIT_COMMENT_STRING`".
> 
> Elsewhere in the documentation (such as Documentation/config.adoc and
> Documentation/git-var.adoc), 'git var' invocations in backticks are
> written without surrounding double quotes, so dropping the outer quotes
> here would match the surrounding style.

I change it to match the existing style

Thanks

Phillip

>> diff --git a/builtin/var.c b/builtin/var.c
>> index eb85a985b15..6dc8ec4ba9f 100644
>> --- a/builtin/var.c
>> +++ b/builtin/var.c
>> @@ -188,6 +188,11 @@ static char *hostname(int ident_flag UNUSED)
>>   	return xstrdup(buf);
>>   }
>>   
>> +static char *comment_string(int ident_flag UNUSED)
>> +{
>> +	return xstrdup(comment_line_str);
>> +}
>> +
> 
> OK, like other .read() functions like committer(), we return a copy to
> the caller to be consumed by list_vars(), which will free() it
> afterwards.
> 
>> diff --git a/t/t0007-git-var.sh b/t/t0007-git-var.sh
>> index 883a45399e2..f228cb5bb6f 100755
>> --- a/t/t0007-git-var.sh
>> +++ b/t/t0007-git-var.sh
>> @@ -434,4 +434,14 @@ test_expect_success 'git var -l lists the identity components' '
>>   	test_grep "^GIT_COMMITTER_DATE=" actual
>>   '
>>   
>> +test_expect_success 'GIT_COMMENT_STRING' '
>> +	git var GIT_COMMENT_STRING >actual &&
>> +	echo "#" >expect &&
>> +	test_cmp expect actual &&
>> +	git -c core.commentChar=: -c core.commentString=%% \
>> +		var GIT_COMMENT_STRING >actual &&
>> +	echo %%>expect &&
>> +	test_cmp expect actual
>> +'
>> +
> 
> Checking the default and core.commentString overriding core.commentChar
> looks good.  If you happen to reroll for anything else, testing the
> reverse order (core.commentString followed by core.commentChar) would
> exercise last-one-wins in both directions, though it is certainly not
> necessary on its own.
> 
> Looking very good.  Will queue.
> 
> Thanks.
Technical Details
Message-ID: <95b44801-8c10-4d1e-bb41-c5ba3ee13695@gmail.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76524-linux-kernel-git=dewy.ru
References: <fa8b80af26481e0dc96fd8f80f3c7ba84f60f9d4.1795516651.git.phillip.wood@dunelm.org.uk> <6e310e0af58cf693819a8d7384c1560e2e342d4b.1795710343.git.phillip.wood@dunelm.org.uk> <xmqq5wxjia5q.fsf@gitster.g>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76524-linux-kernel-git=dewy.ru
From: phillip.wood123@gmail.com (Phillip Wood)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH v2] var: add GIT_COMMENT_STRING
Date: Fri, 27 Nov 2026 16:42:49 +0000
Organization: Usenet Network
Message-ID: <95b44801-8c10-4d1e-bb41-c5ba3ee13695@gmail.com>
References: <fa8b80af26481e0dc96fd8f80f3c7ba84f60f9d4.1795516651.git.phillip.wood@dunelm.org.uk>
 <6e310e0af58cf693819a8d7384c1560e2e342d4b.1795710343.git.phillip.wood@dunelm.org.uk>
 <xmqq5wxjia5q.fsf@gitster.g>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="774776"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:95vIECruhy7dqGK3gcTso5buxLg= sha256:g9PEJewpwIuWX/mA1qsVL6IT1oOxrOxgIY/qBb455ic=
	sha1:Gnt2H3SX06vFJ20wRa6hdFRmCMs= sha256:5cml30k4p1rnBMLFPIiYnDNzWNWx1tWyi7MpYVdippw=
Content-Language: en-US
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 BA833125F61; Fri, 27 Nov 2026 19:43:12 +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 5Z4XBrubsOjj;
	Fri, 27 Nov 2026 19:43:09 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-76524-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 E6B37125F5E; Fri, 27 Nov 2026 19:43:00 +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 CED723024C; Fri, 27 Nov 2026 16:42:56 +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=1795797776;
	b=CkzZCxDO224lUJ6wpb+Fk7E0mjqTA2qok9QI+DKgvrLPFjSUppaOIsMnce56MFspIFmG
	 U05z4QHSaljXJnBRRZPVqCNkucPG77tFXeh9TivWr0gwuiytYY92BGtH/f596pdZc4OOp
	 M5YJjDE2CqA3mHhlU9ZL7sp4ORy8GJ7oTA31Q2TCSZiv/DPNoVfYYxH0qrMCIQHjdpvkp
	 MXd1wz9V+KQ6GB6FyVfGNrSBP9OgRZgiTY9dm9j/11/4S8oKUX8+cUKr+16QjRs2yWcEp
	 bq2WWoPSz3qIJt7o7C2zPFdlCv+M6i1MYwwpaSQgH5JBA3vKdEhShHAaXxNgEd/4QGg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795797776;
	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:Date:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 User-Agent:Reply-To:Subject:To:Cc:References:Content-Language:From:
	 In-Reply-To:Content-Type:Content-Transfer-Encoding;
	bh=UreNwihSM0bmRjyF4LIQSlBXp8gZoNRQaM901ln5iJU=;
	b=yq16rxzC2rIMTa2yAA5qh//ueQdAqhOylM/mG89DUN0fLka61/T3WkOQsf/YbxldltGC
	 Z31bmOgE4i4mDaHbsfzHnJwoIh/Aoaa8phdBvLDr2MCvwEj5zt1UBG8MDL0XHbTWHYnjp
	 qK/M+Fx/uLLLzVO0xDO86BISMeLGubl+wa8QnToSBzfCOySISOrU53/EO5mZGjpJIyEvO
	 +t55GnYdq4K+t1IOz5v2L5DCYh9MxS3vOnMxoIyeVT69lxpfeabcVcPRzCKdQkb1VCbtW
	 urQB71c+MZKrcGL45WXbRPDB939uNa3fHLTFZOyLSE02dmWZwMRJruTTwNnSNAPXkzg==
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=eFDcCi0z;
	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 418CF606A33A;
	Fri, 27 Nov 2026 16:42:56 +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=eFDcCi0z
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.50
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795797775;
	b=zy4BKIq0na8U/KSP2dTvRhUDkMcz6xI+h4vM6weF2w8lLj8sySMNhqO1mBgZeZNsTrxY
	 xu8IqFf7hP7OStjGCgSqJurVr3rSH1XigcH+lZisftNPIcCAx074Q/CgFUgcKcpwcuhAC
	 pOuDz4gjQOu1PGMR6lTO3FLMBzYrAvT3UuP/CdaE1yLr5YZSu93CYPrTnMOeDOHiiH1ih
	 rAUzZQxIwvHQpYYXXbKjPBEeWz+r6tLhk+KpQcFTj54v1iIFxkKxrHEKNUa8OBoElf/e+
	 nY4+lza6rE1bsPMQWN0q+prC2icfSmjMd1u+n+RTeh52R7R+EqKtJmCNzAN5WBuQa0Q==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795797775;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Message-ID:Date:
	 MIME-Version:User-Agent:Reply-To:Subject:To:Cc:References:
	 Content-Language:From:In-Reply-To:Content-Type:
	 Content-Transfer-Encoding;
	bh=UreNwihSM0bmRjyF4LIQSlBXp8gZoNRQaM901ln5iJU=;
	b=gd06/z7aOvnqR5SAO/GwdUnOL9MhO+ODfteeh5eZeaAzt3FhflMqY1J6AmrRAiqkfqY+
	 bD3AbzExv4dWaJ9UXujbFa+ruDbvOefdC8fcOQhyz+7wzfwd69Hooz6ge31+H8N0P8/z/
	 X1SWH8oIF6YLDp8ROfYd1TJQPsy8r1yfdAsWbe4Kh08vFy/IlaP9/rFSZmFunCwErtNqD
	 TGpwctp4jJRTcnDwnL3nhq2l6BZasaQDsy9w1pTZM/LVFVV8KE37sAstGVBxN78vp5guR
	 md93cvf9p6GMq2eBQPx1aSGDwrUIiMK/RUyakiR1J3mYNsrouKbm7m+lv8B96Wxteyg==
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=eFDcCi0z;
	arc=none smtp.remote-ip=209.85.221.50
X-Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50])
	(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 D1C38606A32E
	for <git@vger.kernel.org>; Fri, 27 Nov 2026 16:42:52 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D1C38606A32E
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-wr1-f50.google.com with SMTP id ffacd0b85a97d-48dee593f18so7808591f8f.3
        for <git@vger.kernel.org>; Fri, 27 Nov 2026 08:42:52 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1795797771; x=1796402571; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:in-reply-to:from
         :content-language:references:cc:to:subject:reply-to:user-agent
         :mime-version:date:message-id:from:to:cc:subject:date:message-id
         :reply-to:content-type;
        bh=UreNwihSM0bmRjyF4LIQSlBXp8gZoNRQaM901ln5iJU=;
        b=eFDcCi0zgnuvBydEzb2HaB6PRroNKxS4cBcNDGS+3zj3BWolZzrAWtyrHkOSOEtHUU
         KkXw7DML1Hn02o8u0/prdhlz/S8jgSVch70uGUQGcPDHfhoD5ZLaCWdNy8oJqjl60cH3
         GFRfj+VxlmjKX+mhlHtwfxiDWTiDRe/HS5eknhQ29hxLTy5LRWBa5HsikleGddU5gOWR
         cUklw5InbmHFZMSM2Ht0dHMAa9sQp4mKsvSW/XgLESlY7BC7V1tW+21NXroPe0O0wh41
         XIBB8peMZvKkoSjrpRbP7cVeXhCVxzr9LF4+HImp4fhGKuwB5d0P8CdhiM97V7uXN9RP
         0OPg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1795797771; x=1796402571;
        h=content-transfer-encoding:content-type:in-reply-to:from
         :content-language:references:cc:to:subject:reply-to:user-agent
         :mime-version:date:message-id:x-gm-gg:x-gm-message-state:from:to:cc
         :subject:date:message-id:reply-to:content-type;
        bh=UreNwihSM0bmRjyF4LIQSlBXp8gZoNRQaM901ln5iJU=;
        b=sRLoj4msZrQ7dqTc/N5rjDZUfU1rXZF+CMs9IR7S12hg8X8Sp6d833wffdye/x8syu
         9JDGVfO8WI2RB/dQFD16u9CxddDUe2yQm2laIKF4HH9B++qF8YziER0o1HbOhcgf7uJY
         0s1Dd1R2tw1YTiDLZjhvEbjyzbE0D2VqxTP1pa1uFe+6RrkHe7rwokIxhaemwxalno8f
         z5iNRqx/ADGorcQYEh+sPuXr0/XPI55Oq1cGyid+LZ4r2s0VC1Af7OjdS7McQvGJrkOP
         7W6locKjgsVGDbrXdhfzwQfmuAApDVAwE+DZ9gh/EOM5IV72sPl+w4O8I26zaGtQLDLm
         dIxA==
X-Gm-Message-State: APuU4Z+rPKQXDjPjMB0clnRUHD7028S8vNE/1HIISTUCZsQECthjCEAZ
	Bfu1F+udLIi/aUw+jCaygpSdQeKjfJyG6y9fR7L5qsfzMywMjievYAdu
X-Gm-Gg: AZFdTZemMVBYDY3FixS0kftbD829Uma4cRgoktEPJukP224NcCl5yxKgJXT8hQ7QYMu
	h1Yoe54bvolcrCQzVsGA8IsZRrme8QDLsPVPqdTGu6vKEVSekAj8wXTpD1mH4/xObiTMrusm9ZD
	s/ssuNDM8+qkMtOq66XhGU89d1CTSAQUKvHu+uiJiYAtKsQun00tGPDEyzqHxrwduRNieJPpHTe
	JfJtWqWyZtdBNreNqc1TqYq+JfCZuEhFo5hVd6klM8ofmHU/FZYu9TaYu2UEWwpdICvpGMF9KtF
	ZyYqhrw86sqGTqvpUeCJzhOlAThun2uBWrUxoiJhvwPbwL0S+ZeVGPg+Waj+wRoNxXeveKxLMJA
	Ynygv3TN0Gw6YaahZwErXo2DG7YROTpAZaOowjjAWDTBt+J1UfCKGIYJf0h4QSACdiCHOQn4355
	YpId7nUsASKK9m/U08o64d3Rh4NjpT+AO6Q8cZZKu4csqhdoMRWHuIa+irN9tNYD751ThtJSOpN
	W2cgJP/uqYjJG4C1nOtnYot88dyx11yOIgGg9vgG8qc+si8BGYdJdjNYMh84RQtqU0KGxTroN+Y
	xjPjtScd3Nra3WgTB4WD8Xc9OA++E7djsD1g2qFuj6Yo1Z0tO1U8uKadrnvsuyu+0FkRDg3PXKH
	QJbwcrmn/dpvKv6qSSCEZlMMZdcT1
X-Received: by 2002:a05:6000:491a:b0:4ac:37ff:140b with SMTP id ffacd0b85a97d-4ac37ff143amr45242008f8f.25.1795797770839;
        Fri, 27 Nov 2026 08:42:50 -0800 (PST)
X-Received: from ?IPV6:2a0a:ef40:724:6601:f3ff:aebc:61f8:d91f? ([2a0a:ef40:724:6601:f3ff:aebc:61f8:d91f])
        by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab65cb41f4sm46520838f8f.7.2026.11.27.08.42.49
        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
        Fri, 27 Nov 2026 08:42:50 -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-User-Agent: Mozilla Thunderbird
X-Reply-To: phillip.wood@dunelm.org.uk
X-Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
 Kristoffer Haugsbakk <code@khaugsbakk.name>
X-In-Reply-To: <xmqq5wxjia5q.fsf@gitster.g>