Re: [PATCH v4 1/2] blame: prevent error if range ends past end of file

2018-05-01 Thread Junio C Hamano
Isabella Stephens writes: > This is the existing behaviour. -L10,-20 for example will blame the > first 10 lines of a file, it will not fail. My patch doesn't change > this. The case I am discussing is -L,-20 which at the moment blames > the first line of the file.

Re: [PATCH v4 1/2] blame: prevent error if range ends past end of file

2018-04-26 Thread Isabella Stephens
> Maybe I misread the previous discussion and/or your cover letter, > but I have been assuming that you are trying to avoid failing the > command in a useless way (e.g. when the file has only ~800 lines but > the user does not know exactly how many, instead of letting -L1,820 > to fail with "the

Re: [PATCH v4 1/2] blame: prevent error if range ends past end of file

2018-04-26 Thread Junio C Hamano
Isabella Stephens writes: > On 27/4/18 10:50 am, Junio C Hamano wrote: >> isteph...@atlassian.com writes: >> >>> diff --git a/line-range.c b/line-range.c >>> index 323399d16..023aee1f5 100644 >>> --- a/line-range.c >>> +++ b/line-range.c >>> @@ -47,7 +47,7 @@ static

Re: [PATCH v4 1/2] blame: prevent error if range ends past end of file

2018-04-26 Thread Isabella Stephens
My intention was to modify existing behaviour as little as possible, but I agree clipping to the first line makes a lot more sense. That raises the question though, do we clip to 1 and treat -L,-n as a valid input, or clip to -1 so that this case be detected? On 27/4/18 10:50 am, Junio C Hamano

Re: [PATCH v4 1/2] blame: prevent error if range ends past end of file

2018-04-26 Thread Junio C Hamano
isteph...@atlassian.com writes: > diff --git a/line-range.c b/line-range.c > index 323399d16..023aee1f5 100644 > --- a/line-range.c > +++ b/line-range.c > @@ -47,7 +47,7 @@ static const char *parse_loc(const char *spec, > nth_line_fn_t nth_line, > else if (!num) >

[PATCH v4 1/2] blame: prevent error if range ends past end of file

2018-04-26 Thread istephens
From: Isabella Stephens If the -L option is used to specify a line range in git blame, and the end of the range is past the end of the file, git will fail with a fatal error. This commit prevents such behavior - instead we display the blame for existing lines within the