From: Junio C Hamano Date: Mon, 21 Sep 2026 17:30:53 GMT Subject: Re: [PATCH] line-range: skip trailing empty lines in funcname range Message-ID: In-Reply-To: "Kristofer Karlsson via GitGitGadget" 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 ;-).