Merge branch 'ag/rebase-i-in-c' into js/rebase-in-c-5.5-work-with-rebase-i-in-c
[gitweb.git] / builtin / blame.c
index 468b17c30c3594f63c9c9b1eedc2f436b1f89337..5c93d169dd431b666b25086ac4bb5303e8b26309 100644 (file)
@@ -1002,13 +1002,13 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
                                    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);