Merge branch 'is/parsing-line-range'
[gitweb.git] / line-log.c
index fa9cfd5bdbb5dfe4a1ca5c7f7711435caf091805..e5af5d0e455abd1361e696783e468a074a49fc2f 100644 (file)
@@ -598,11 +598,11 @@ parse_lines(struct commit *commit, const char *prefix, struct string_list *args)
                                    lines, anchor, &begin, &end,
                                    full_name))
                        die("malformed -L argument '%s'", range_part);
-               if (lines < end || ((lines || begin) && lines < begin))
+               if ((!lines && (begin || end)) || lines < begin)
                        die("file %s has only %lu lines", name_part, lines);
                if (begin < 1)
                        begin = 1;
-               if (end < 1)
+               if (end < 1 || lines < end)
                        end = lines;
                begin--;
                line_log_data_insert(&ranges, full_name, begin, end);