diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-08-02 15:30:41 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-02 15:30:41 -0700 |
commit | 6566a917d8a8d3070b5fdc94fbe5f6d68a4d656b (patch) | |
tree | 5a8ac927a48d840786c5cca578221008f2baf9d1 /builtin/blame.c | |
parent | Merge branch 'jt/fetch-pack-negotiator' (diff) | |
parent | log: prevent error if line range ends past end of file (diff) | |
download | tgif-6566a917d8a8d3070b5fdc94fbe5f6d68a4d656b.tar.xz |
Merge branch 'is/parsing-line-range'
Parsing of -L[<N>][,[<M>]] parameters "git blame" and "git log"
take has been tweaked.
* is/parsing-line-range:
log: prevent error if line range ends past end of file
blame: prevent error if range ends past end of file
Diffstat (limited to 'builtin/blame.c')
-rw-r--r-- | builtin/blame.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/blame.c b/builtin/blame.c index 468b17c30c..5c93d169dd 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -1002,13 +1002,13 @@ parse_done: nth_line_cb, &sb, lno, anchor, &bottom, &top, sb.path)) usage(blame_usage); - if (lno < top || ((lno || bottom) && lno < bottom)) + if ((!lno && (top || bottom)) || lno < bottom) die(Q_("file %s has only %lu line", "file %s has only %lu lines", lno), path, lno); if (bottom < 1) bottom = 1; - if (top < 1) + if (top < 1 || lno < top) top = lno; bottom--; range_set_append_unsafe(&ranges, bottom, top); |