Skip to content

line-range: skip trailing empty lines in funcname range - #2234

Open
spkrka wants to merge 1 commit into
gitgitgadget:masterfrom
spkrka:krka/line-range-trailing-blank
Open

spkrka wants to merge 1 commit into
gitgitgadget:masterfrom
spkrka:krka/line-range-trailing-blank

Conversation

@spkrka

@spkrka spkrka commented Sep 21, 2026

Copy link
Copy Markdown

cc: René Scharfe l.s.r@web.de
cc: Nikita Makarov n.makarov@yadro.com

@spkrka

spkrka commented Sep 21, 2026

Copy link
Copy Markdown
Author

/cc Nikita Makarov n.makarov@yadro.com

@gitgitgadget

gitgitgadget Bot commented Sep 21, 2026

Copy link
Copy Markdown

User Nikita Makarov <n.makarov@yadro.com> has been added to the cc: list.

@spkrka
spkrka force-pushed the krka/line-range-trailing-blank branch 2 times, most recently from 7fd6178 to 40609b2 Compare September 21, 2026 10:47
git log -L :funcname: includes trailing empty lines in the
function range. This boils down to parse_range_funcname()
extending the range forward until it either reaches end-of-file
or another function, without skipping empty lines at the
boundary. Including empty lines is inconsistent with how it
works for git grep -W.

Fix this by trimming trailing empty lines from the computed range,
with the same goal as this fix (though with a different approach):

    8e5dd94 (grep: -W: skip trailing empty lines at EOF, too,
    2024-07-30)

Reported-by: Nikita Makarov <n.makarov@yadro.com>
Signed-off-by: Kristofer Karlsson <krka@spotify.com>
@spkrka
spkrka force-pushed the krka/line-range-trailing-blank branch from 40609b2 to f2e217d Compare September 21, 2026 10:51
@spkrka

spkrka commented Sep 21, 2026

Copy link
Copy Markdown
Author

/submit

@gitgitgadget

gitgitgadget Bot commented Sep 21, 2026

Copy link
Copy Markdown

Submitted as pull.2234.git.1789991377413.gitgitgadget@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-2234/spkrka/krka/line-range-trailing-blank-v1

To fetch this version to local tag pr-2234/spkrka/krka/line-range-trailing-blank-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-2234/spkrka/krka/line-range-trailing-blank-v1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant