diff options
| author | Michael Montalbo <mmontalbo@gmail.com> | 2026-07-06 05:01:56 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-07-06 13:26:59 -0700 |
| commit | 4f8f121effc5dc7fcc4fcc98c60c5b92ec6f87f4 (patch) | |
| tree | fb1ee3b9c7de38c55f756415f4cedf55a81ce4ad /t/t7501-commit-basic-functionality.sh | |
| parent | c451e96f3f6da47bab881b6b1246417691ce66d4 (diff) | |
t: fix Lexer line count for $() inside double-quoted strings
scan_dqstring's post-loop newline counter re-counts newlines that
were already counted during recursive parsing of $() bodies. This
happens because scan_dollar returns text containing newlines (from
multi-line command substitutions), and the catch-all counter at the
end of scan_dqstring counts all of them again.
Fix this by counting newlines inline as non-special characters are
consumed, and removing the post-loop catch-all. Each newline is
now counted exactly once: literal newlines at the inline match,
line splices at the backslash handler, and $() newlines by
scan_token during the recursive parse.
This is a latent bug: any consumer that relies on token line
numbers rather than byte offsets would get incorrect results for
tokens following a multi-line $() inside a double-quoted string.
chainlint is not affected because it annotates the original body
text using byte offsets, not token line numbers.
Signed-off-by: Michael Montalbo <mmontalbo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7501-commit-basic-functionality.sh')
0 files changed, 0 insertions, 0 deletions
