summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--line-log.c2
-rwxr-xr-xt/t4211-line-log.sh3
2 files changed, 4 insertions, 1 deletions
diff --git a/line-log.c b/line-log.c
index 5234879..6f94d56 100644
--- a/line-log.c
+++ b/line-log.c
@@ -115,6 +115,8 @@ static void sort_and_merge_range_set(struct range_set *rs)
qsort(rs->ranges, rs->nr, sizeof(struct range), range_cmp);
for (i = 0; i < rs->nr; i++) {
+ if (rs->ranges[i].start == rs->ranges[i].end)
+ continue;
if (o > 0 && rs->ranges[i].start <= rs->ranges[o-1].end) {
if (rs->ranges[o-1].end < rs->ranges[i].end)
rs->ranges[o-1].end = rs->ranges[i].end;
diff --git a/t/t4211-line-log.sh b/t/t4211-line-log.sh
index d98efb3..e7a6e49 100755
--- a/t/t4211-line-log.sh
+++ b/t/t4211-line-log.sh
@@ -67,7 +67,8 @@ test_bad_opts "-L :foo:b.c" "no match"
# There is a separate bug when an empty -L range is the first -L encountered,
# thus to demonstrate this particular bug, the empty -L range must follow a
# non-empty -L range.
-test_expect_failure '-L {empty-range} (any -L)' '
+test_expect_success '-L {empty-range} (any -L)' '
+ n=$(expr $(cat b.c | wc -l) + 1) &&
n=$(expr $(wc -l <b.c) + 1) &&
git log -L1,1:b.c -L$n:b.c
'