]> git.ipfire.org Git - thirdparty/git.git/commit - t/t4211-line-log.sh
log: prevent error if line range ends past end of file
authorIsabella Stephens <istephens@atlassian.com>
Fri, 15 Jun 2018 06:29:28 +0000 (16:29 +1000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 15 Jun 2018 17:29:14 +0000 (10:29 -0700)
commit7f81c00f3b1bd45c2954b18550b8e351651f72f3
treeca5a971b2a150d15d20dcd14fee9346db6abee0a
parent96cfa94e68cfbe9942e230ae18b35eaf1ca30f99
log: prevent error if line range ends past end of file

If the -L option is used to specify a line range in git log, and the end
of the range is past the end of the file, git will fail with a fatal
error. This commit prevents such behaviour - instead we perform the log
for existing lines within the specified range.

This commit also fixes a corner case where -L ,-n:file would be treated
as a log over the whole file. Now we treat this as -L 1,-n:file and
blame the first line of the file instead.

Signed-off-by: Isabella Stephens <istephens@atlassian.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
line-log.c
t/t4211-line-log.sh