diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-01-02 21:37:18 +0900 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-01-02 21:37:18 +0900 |
| commit | 3f2e4c09c769dc2fbbabfcfa625451f9d98bd49a (patch) | |
| tree | 80262707133197b57544e2287f395c6806ac1d49 /t | |
| parent | The third batch (diff) | |
| parent | line-range: fix infinite loop bug with '$' regex (diff) | |
| download | git-3f2e4c09c769dc2fbbabfcfa625451f9d98bd49a.tar.gz git-3f2e4c09c769dc2fbbabfcfa625451f9d98bd49a.zip | |
Merge branch 'lk/line-range-parsing-fix'
When given a pattern that matches an empty string at the end of a
line, the code to parse the "git diff" line-ranges fell into an
infinite loop, which has been corrected.
* lk/line-range-parsing-fix:
line-range: fix infinite loop bug with '$' regex
Diffstat (limited to 't')
| -rwxr-xr-x | t/t4211-line-log.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/t/t4211-line-log.sh b/t/t4211-line-log.sh index ac9e4d0928..c6540e822f 100755 --- a/t/t4211-line-log.sh +++ b/t/t4211-line-log.sh @@ -315,4 +315,26 @@ test_expect_success 'line-log with --before' ' test_cmp expect actual ' +test_expect_success 'setup tests for zero-width regular expressions' ' + cat >expect <<-EOF + Modify func1() in file.c + Add func1() and func2() in file.c + EOF +' + +test_expect_success 'zero-width regex $ matches any function name' ' + git log --format="%s" --no-patch "-L:$:file.c" >actual && + test_cmp expect actual +' + +test_expect_success 'zero-width regex ^ matches any function name' ' + git log --format="%s" --no-patch "-L:^:file.c" >actual && + test_cmp expect actual +' + +test_expect_success 'zero-width regex .* matches any function name' ' + git log --format="%s" --no-patch "-L:.*:file.c" >actual && + test_cmp expect actual +' + test_done |
