diff options
author | Jeff King <peff@peff.net> | 2016-07-22 12:28:44 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-07-22 12:33:45 -0700 |
commit | 74a7fa44d36c3e93febccdea5f44ff78555463d0 (patch) | |
tree | e62886ca079ea6571f4e665169ecc8906c898593 /xdiff/xemit.c | |
parent | Merge branch 'jk/dotgit-case-maint-1.8.5' into maint-1.8.5 (diff) | |
download | tgif-74a7fa44d36c3e93febccdea5f44ff78555463d0.tar.xz |
contrib/git-jump: fix greedy regex when matching hunks
The hunk-header regex looks for "\+\d+" to find the
post-image line numbers, but it skips the pre-image line
numbers with a simple ".*". That means we may greedily eat
the post-image numbers and match a "\+\d" further on, in the
funcname text.
For example, commit 6b9c38e has this hunk header:
diff --git a/t/t0006-date.sh b/t/t0006-date.sh
[...]
@@ -50,8 +50,8 @@ check_show iso-local "$TIME" '2016-06-15 14:13:20 +0000'
If you run:
git checkout 6b9c38e
git jump diff HEAD^ t/
it will erroneously match "+0000" as the starting line
number and jump there, rather than line 50.
We can fix it by just making the "skip" regex non-greedy,
taking the first "+" we see, which should be the post-image
line information.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'xdiff/xemit.c')
0 files changed, 0 insertions, 0 deletions