From: Junio C Hamano <gitster@pobox.com>
To: "Kristofer Karlsson via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, "René Scharfe" <l.s.r@web.de>,
"Nikita Makarov" <n.makarov@yadro.com>,
"Kristofer Karlsson" <krka@spotify.com>
Subject: Re: [PATCH] line-range: skip trailing empty lines in funcname range
Date: Mon, 21 Sep 2026 10:30:53 -0700 [thread overview]
Message-ID: <xmqqse32mrzm.fsf@gitster.g> (raw)
In-Reply-To: <pull.2234.git.1789991377413.gitgitgadget@gmail.com> (Kristofer Karlsson via GitGitGadget's message of "Mon, 21 Sep 2026 11:49:37 +0000")
"Kristofer Karlsson via GitGitGadget" <gitgitgadget@gmail.com>
writes:
> diff --git a/line-range.c b/line-range.c
> index b99f0d9895..44b52d4e34 100644
> --- a/line-range.c
> +++ b/line-range.c
> @@ -233,6 +233,11 @@ static const char *parse_range_funcname(
> (*end)++;
> }
>
> + /* exclude trailing empty lines from the function range */
> + while (*end > *begin + 1 &&
> + nth_line_cb(cb_data, *end - 1)[0] == '\n')
> + (*end)--;
> +
While the new behaviour may mean well, the implementation falls a
bit short of matching what "grep -W" did, doesn't it? Over there we
treat a line with only whitespace characters on it as an empty line
that we want to ignore, but the above code does not allow anything
before the LF. I do not know offhand if the above misbehaves on
CRLF text files, but if you treated a line with only whitespace
characters on it as an empty line, concerns on CRLF files would also
disappear ;-).
next prev parent reply other threads:[~2026-09-21 17:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 11:49 [PATCH] line-range: skip trailing empty lines in funcname range Kristofer Karlsson via GitGitGadget
2026-09-21 17:30 ` Junio C Hamano [this message]
2026-09-21 18:58 ` Kristofer Karlsson
2026-09-25 10:35 ` [PATCH v2] line-range: skip trailing blank " Kristofer Karlsson via GitGitGadget
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqse32mrzm.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=krka@spotify.com \
--cc=l.s.r@web.de \
--cc=n.makarov@yadro.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.