Re: [PATCH v3] blame: prevent error if range ends past end of file

2017-10-26 Thread Eric Sunshine
On Fri, Oct 27, 2017 at 2:18 AM, Isabella Stephens wrote: > On 27/10/17 12:58 pm, Junio C Hamano wrote: >> There should be an "is the range sensible?" check after all the >> tweaking to bottom and top are done, I think. > > My mistake. I missed that case. I think this section of code is a little >

Re: [PATCH v3] blame: prevent error if range ends past end of file

2017-10-26 Thread Isabella Stephens
On 27/10/17 12:58 pm, Junio C Hamano wrote: > Isabella Stephens writes: > >> diff --git a/builtin/blame.c b/builtin/blame.c >> index 67adaef4d..b5b9db147 100644 >> --- a/builtin/blame.c >> +++ b/builtin/blame.c >> @@ -878,13 +878,13 @@ int cmd_blame(int argc, const char **argv, const char >> *pr

Re: [PATCH v3] blame: prevent error if range ends past end of file

2017-10-26 Thread Junio C Hamano
Junio C Hamano writes: > For example, with an empty file (i.e. lno == 0), you can ask "git > blame -L1,-4 ("i.e. "at most four lines, ending at line #1") and the > code silently accepts the input without noticing that the request is > an utter nonsense; "file X has only 0 lines" error is given a

Re: [PATCH v3] blame: prevent error if range ends past end of file

2017-10-26 Thread Junio C Hamano
Isabella Stephens writes: > diff --git a/builtin/blame.c b/builtin/blame.c > index 67adaef4d..b5b9db147 100644 > --- a/builtin/blame.c > +++ b/builtin/blame.c > @@ -878,13 +878,13 @@ int cmd_blame(int argc, const char **argv, const char > *prefix) > nth_line_cb,

[PATCH v3] blame: prevent error if range ends past end of file

2017-10-26 Thread 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, at present git will fail with a fatal error. This commit prevents such behavior - instead the blame is displayed for existing lines within the specified range. Blaming a range that i