diff options
author | Bo Yang <struggleyb.nku@gmail.com> | 2013-03-28 20:47:30 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-03-28 21:28:41 +0400 |
commit | 25ed3412f86b136efb17689b6712d9e546cac388 (patch) | |
tree | fdb5d94dcd935ce30be00a616ff1619752421179 /t/t8003-blame-corner-cases.sh | |
parent | 443d803e0dacd0a1c6700503689f3cd95751aba1 (diff) |
Refactor parse_loc
We want to use the same style of -L n,m argument for 'git log -L' as
for git-blame. Refactor the argument parsing of the range arguments
from builtin/blame.c to the (new) file that will hold the 'git log -L'
logic.
To accommodate different data structures in blame and log -L, the file
contents are abstracted away; parse_range_arg takes a callback that it
uses to get the contents of a line of the (notional) file.
The new test is for a case that made me pause during debugging: the
'blame -L with invalid end' test was the only one that noticed an
outright failure to parse the end *at all*. So make a more explicit
test for that.
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t8003-blame-corner-cases.sh')
-rwxr-xr-x | t/t8003-blame-corner-cases.sh | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh index 230143cf31..e7cac1db55 100755 --- a/t/t8003-blame-corner-cases.sh +++ b/t/t8003-blame-corner-cases.sh @@ -175,6 +175,12 @@ test_expect_success 'blame -L with invalid end' ' grep "has only 2 lines" errors ' +test_expect_success 'blame parses <end> part of -L' ' + git blame -L1,1 tres >out && + cat out && + test $(wc -l < out) -eq 1 +' + test_expect_success 'indent of line numbers, nine lines' ' git blame nine_lines >actual && test $(grep -c " " actual) = 0 |