Article View: linux.kernel.git
Article #3034Re: git context diff does not recognize shell function name
From: Junio C Hamano
Date: Thu, 12 Nov 2026 20:51
Date: Thu, 12 Nov 2026 20:51
67 lines
14867 bytes
14867 bytes
"Windl, Ulrich" <u.windl@ukr.de> writes:
> Hi!
>
> In git 2.51.0 I found a minor issue:
That is a release from more than a year ago, but I do not think we
had any change to userdiff (i.e., built-in patterns that define what
line is the function header for various languages) since then (we
added Swift and tweaked scheme). So for practical purposes, I would
expect that whatever you saw in Git 2.51 for shell to be reproducible
in today's code.
Or are you reporting that Git 2.50 (or something older than 2.51)
behaved in a way you prefer, and 2.51 behaves differently?
> "git diff" did not show the corresponding shell function
> name. Admittedly I used a somewhat uncommon line-breaking:
>
> The context in question looks like this:
> ---
> ...
> run_query()
> {
> local p_l_0="$1" LOG_BASE="$2" SUFFIX="$3" URL_BASE="$4" URL="$5" \
> _COUNT="${6:-$COUNT}" RESPONSE_CHECKER="$7"
> local me="${FUNCNAME[0]}" m
> ...
> ---
>
> The context diff looked like this:
> ---
> ...
> @@ -193,6 +188,36 @@ get_params()
> ...
> run_query()
> {
I assume that your e-mail message is whitespace damaged and
run_query() is actually indented by one space, being a context line
together with the opening brace next line? The header stating
get_params() is expected, as the "function name" do not lookahead to
find run_query() in the hunk it is going to show.
> @@ -201,10 +226,9 @@ _COUNT="${6:-$COUNT}" RESPONSE_CHECKER="$7"
It is not that the line that begins run_query()'s definition does
not look like a beginning of a function. It is that this _COUNT=
line does look like a beginning of a new thing, and because it comes
after the start of run_query().
The name of the file would affect which set of regular expressions
are used to sift lines into function headers and other lines. When
the file has no known suffix with language specific rules defined, I
think we just pick any line that begins with a non-whitespace
character, which explains why the line that begins with
_COUNT=... overrides the line that begins with run_query() which
would have been a candidate as another and later candidate.
> local me="${FUNCNAME[0]}" m
> ...
> ---
> ("..." is deleted lines)
> So this may be a combination of unfortunate context sequencing and
> the first line of the new context being unusual. The second chunk
> would still be the same context, namely "run_query()".
Technical Details
Message-ID:
<xmqqmrrdhiye.fsf@gitster.g>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-75332-linux-kernel-git=dewy.ruReferences:
<340dc2eef42f4f6690c58765a07621e1@ukr.de>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-75332-linux-kernel-git=dewy.ru
From: gitster@pobox.com (Junio C Hamano)
Newsgroups: linux.kernel.git
Subject: Re: git context diff does not recognize shell function name
Date: Thu, 12 Nov 2026 12:51:21 -0800
Organization: Usenet Network
Message-ID: <xmqqmrrdhiye.fsf@gitster.g>
References: <340dc2eef42f4f6690c58765a07621e1@ukr.de>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: usenet.network;
logging-data="1196111"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:jJXrzo+w59Cm0EcxXynMOAUVfzc= sha256:HdgmvdtKneqOUbSeQHww4DxvqRYlfDIDy6LkSp1nFvs=
sha1:YLTEcPt5PtLQnF5OEEaziM9fJss= sha256:l6RrwHocGjhUDfwMy9tHANLGZdoR4heQw3HvoVKw0Lk=
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 EECA11143BA; Fri, 13 Nov 2026 01:38:31 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 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, 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=pobox.com header.b=M1p43CUa; dkim=pass (2048-bit key)
header.d=messagingengine.com header.b=ddj1o8MO
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 tv0Qdj2eqlIZ;
Fri, 13 Nov 2026 01:38:28 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-75332-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=pobox.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id B1635114006; Fri, 13 Nov 2026 01:38:14 +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 502AE18A40C; Thu, 12 Nov 2026 20:51:30 +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=1794516688;
b=SPpSKHBwQQd0NtZulZCzPm4PvaBSNtrLp5Iv3hW+ACrfenEmpgdaDIk3SYa/axB2WiSj
ih8lnpsJE3sxwn6rlqUwkWTUvWRJGKgPL8cibNMWdexMyao/761s8P4YkAuFRnxfiZfFR
m0Vj+xI/AxxVypC6QkvAyBuCv+QgWKUp8PnZZv9UC6b4VLo4PX4NQ0HaA6wNJ7xXw612/
6d/nakdZyjK5XRfVLgS2mLqUAkdXfQq44Fa0HzTcW27eSBJ4MubzxJeCwq7osLEDf/jAm
cZqwK//rbKtAhh+t9W6QQA96yGkEL42fK+0Ps05MmdWcX4hRsDh1iNi85VGSK7pwoEA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794516688;
h=X-Original-To:Received:DMARC-Filter:Received:Received:DKIM-Signature:
DKIM-Signature:X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:
Message-Instance:X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:
X-ME-Proxy:Feedback-ID:Received:From:To:Cc:Subject:In-Reply-To:
References:Date:Message-ID:User-Agent:X-Mailing-List:List-Id:
List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
Precedence:MIME-Version:Content-Type;
bh=439eEFuXJFesnjWZpUNl3mKd4MAD90VLXHXI3eT0dYE=;
b=g+K3Js3WYJ8cpw7anTIjVVwQ1BHDUPNQaa1H1+LpwynPDYBsThg0i0cd212o2d9ACOnI
ddmnqy5X1MLUnwdEpYiJRLgRiP+QODZKghpChPRr1Bw2ZtuKoOUyftmxLmDCrGEn611Gc
WWsRZ3GhdPnt9wqp0+WHJwugKSMMVz3y2AViBXaPlWsygTP55uzIzVeGJxkVXbZj5udyv
IHpejRgDZkCsWYBdZwVmBLP0zDFk+KqiaQyzwngQJz+BSBorBEnx5KX9Ct63mY95voGEv
UluIawQko7ycc3H7oWT/SEc073gMRXNeWk/XNW9gWjdtFoRI62v/h0Eh98dvHACC2ug==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=fm2 header.b=M1p43CUa;
dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=ddj1o8MO;
dmarc=pass header.from=pobox.com;
spf=pass smtp.mailfrom=pobox.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 71272606A330;
Thu, 12 Nov 2026 20:51:28 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=fm2 header.b=M1p43CUa;
dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=ddj1o8MO
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=202.12.124.155
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1794516687;
b=1EjZ2PvvLHtTidH8pNIHy8KganRTwxeER0TxSVKQVUxLlA40yd3+MGyedhE+2ysSLDsa
4l4WudoxpBO66gApfqcQ8RvCx0q3UdlCWF/mEtd3Ztf51ZxYyy8JF/I0iqxBDRUgammbx
rWKYxVVQwoakUGT5xNEU3gVHpv729UJlDk3QGeIdbG8erxKOl8c8TPQSj7g66JEkvRm/A
Iq1lDMgMqkBWvnQUPNMWQtEPuoFinTHaYRqsNOG40ebon4IUi+JxpUZaeTNPAJA6HnHPp
+o1UkOKfGbE5T/GauoMbv7W/jtE63WSYYM/z5Ut/cbVyt3NYUIZ/giscIq8OfWqFqVQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794516687;
h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature:
X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:Message-Instance:
X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID:
Received:From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:
User-Agent:MIME-Version:Content-Type;
bh=439eEFuXJFesnjWZpUNl3mKd4MAD90VLXHXI3eT0dYE=;
b=Bn2mpI7ukWejV0oMRjfewFxhY1ux0Hix2AO0Tpr21V4gK+m1QeQsF06Mk3cFno8sOw3u
R3h5GrZMQO3lE36qYTYQjXaZJvwiH0M3GQH1cMs4LvuYazT7naW2LF64bvBubZwEFw7WI
wrxGAx7yTYuAhmTPrrsMKB6E2x36PgkuPs2l2M2I8f54SQfuz7SXK7Mmye81Pe1gmGEFe
NWrmjvlyfq4VbCg3YSEIhrfrfbB3AXOkIQaUUbqSJmzfs8tVt/sVYpj5riZVy0evSYdiy
4ti6y8N+gCXg5Me/8Bs8ABIevTo6eY6Ch/tkYzf5PE3pus19gtXdQF+vNaiCs9BJaWA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=pobox.com;
spf=pass smtp.mailfrom=pobox.com;
dkim=pass header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=fm2 header.b=M1p43CUa;
dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=ddj1o8MO;
arc=none smtp.remote-ip=202.12.124.155
X-Received: from fhigh-b4-smtp.messagingengine.com (fhigh-b4-smtp.messagingengine.com [202.12.124.155])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D217606A31C
for <git@vger.kernel.org>; Thu, 12 Nov 2026 20:51:26 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0D217606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com
X-Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46])
by mailfhigh.stl.internal (Postfix) with ESMTP id E0E9D7A030D
for <git@vger.kernel.org>; Thu, 12 Nov 2026 15:51:23 -0500 (EST)
X-Received: from phl-frontend-01 ([10.202.2.160])
by phl-compute-06.internal (MEProxy); Thu, 12 Nov 2026 15:51:23 -0500
X-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=fm2; t=1794516683; x=1794603083; bh=439eEFuXJF
esnjWZpUNl3mKd4MAD90VLXHXI3eT0dYE=; b=M1p43CUahgpVpOYYVDhvOZIb2F
1tWr24UeTRFZierwsu1VSZeLqomLyS4/ZNpjCO/akFZ18uSoRoje1N08AtqKZsCb
YCNT2jvPu12yxb0Nk95eGJFgLA9/GcQ5jedP4oZxCak1Mvdl2r0Rby9xnSeld8To
ZYOP1JM0Z4kkIcAFdaLNBEDjBaUmJwPJRfBQURpBtdqA8365ASdBWhs81ugoyEPw
czrPNMKsHXfYa0Lw7+kpIS0ZZnsHukCGWZX6xAnQtw+8lgsow0+AKu6y/KWg2MGQ
RXRGuj+UQc45e9r+AYsrO6PhPdtI1KJ9KwLwFv7pSv9CD0UlY0lqzOSjUm4w==
X-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=fm3; t=
1794516683; x=1794603083; bh=439eEFuXJFesnjWZpUNl3mKd4MAD90VLXHX
I3eT0dYE=; b=ddj1o8MOb25CsQ/Gp9JXdwz7ODoeXFLZzPy2EQKpLPSMSSHedPw
5ZLwlzaJ+8V/OoL0QDYOIEsOd3ZcaxgSfhWXq2+D5VrWGxn3OW+9sevG9h3XgYpp
tDQXg9T0feQNGEDrkzq0VBustTdlDmwGWUVARJsOiBJ229swLPUJtuiNFTjVkVcG
gZDMHZM5Ay7+K75urFHhulooWpE+gxT5Lbtfp+TYE8zd1Kk9NIeuVkYYEQbjhv51
NtX1l4dixltemHXl/LCNL0M9vMpeiNmpZTFNNa2r0WI/RnL1m5jBUBqAXgZ9xqmR
2KF/fvOrYAj9USi7JYPNhKjnzFMd0c8MXYQ==
X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09;
repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox;
action=sign d=pobox.com a=rsa-sha256;
X-DKIM2-Signature: i=1; m=1; t=1794516683; d=pobox.com;
mf=PGdpdHN0ZXJAcG9ib3guY29tPg==;
rt=PGdpdEB2Z2VyLmtlcm5lbC5vcmc+;
s=fm2:rsa-sha256:WPwVlkrQNYY7BIp+HT4nRCeaQOfTQfviitJ+y1f5Qw6Gm8u
uVJZPs1Cc20SvLZ/Jn1UvTe2j0CAJz0cdcDPUKJ0r2RUhJdy8ZSJGN5+t0SOQUAL
OeaN16maz2oRdSlM8yu1R+GyhFH32S8CiBUQkGHTXpUV66PPC+Id/W5+At+vEysH
yBIR6Kf7aNmg/QhhphiFIcDX8/3aAp+8keaB6vjNPYFCA6dXFWgrBPIASsByW6Zb
oGEGYetdI3R0wBuyKEdg5KMY5qOarT4/spjGss+hHFvJ0nSvoV6NzCc261o6+T3C
9KVGdO9mWxA0jlZC+zt8Dd1OlZVvJCYnoQmkK9Q==;
X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09;
repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox;
action=mi-m=1; hc=12;
hn=cc,content-type,date,feedback-id,from,in-reply-to,message-id,
mime-version,references,subject,to,user-agent;
X-Message-Instance: m=1; h=sha256:wAA5X/XHQKxLlIR31vnqif6ajGthfUEYRw+Rc5BJWDo=:VUfqr2pSCpqT7Wwebk5yWWAtIrYYiqynDZSVehlVHtg=;
X-ME-Sender: <xms:yyb2agV5LmPKweFNrx_clt9J81IQxMHRnFQdebC1iMXJGUPVcrN9Yg>
<xme:yyb2asD88ZN4qyQVUjmFrUC8SVxPXD20DoddjxR8YBO1WpXJ4yJoI2U1cic-1Yc2D
pJllx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mx:yyb2ag7gPE7I7fNKHvjaKTdwRcJDPHnCNJHF1xZAe8XEo10PFm3TvQ>
<xmx:yyb2apomugmq4AN0BhWlKKpBUOxU2J1CybPjTS6jXqPs7N_jcWaGKh12>
X-Feedback-ID: if26b431b:Fastmail
X-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu,
12 Nov 2026 15:51:23 -0500 (EST)
X-Cc: "git@vger.kernel.org" <git@vger.kernel.org>
X-In-Reply-To: <340dc2eef42f4f6690c58765a07621e1@ukr.de> (Ulrich Windl's message
of "Thu, 12 Nov 2026 13:39:58 +0000")
X-User-Agent: Gnus/5.13 (Gnus v5.13)
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