summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorEric Sunshine <sunshine@sunshineco.com>2013-07-23 10:28:06 -0400
committerJunio C Hamano <gitster@pobox.com>2013-07-23 12:09:14 -0700
commitf8395edc6f5c59a92adcf42ea20a01872ec22700 (patch)
treea7fda097a9751a69ee566ef3a25db1cf0c20bc25 /t
parent99780b0a4ab22c903516601bb3634e6477d7f1c1 (diff)
downloadgit-f8395edc6f5c59a92adcf42ea20a01872ec22700.tar.gz
range-set: satisfy non-empty ranges invariant
range-set invariants are: ranges must be (1) non-empty, (2) disjoint, (3) sorted in ascending order. During processing, various range-set utility functions break the invariants (for instance, by adding empty ranges), with the expectation that a finalizing sort_and_merge_range_set() will restore sanity. sort_and_merge_range_set(), however, neglects to fold out empty ranges, thus it fails to satisfy the non-empty constraint. Subsequent range-set functions crash or throw an assertion failure upon encountering such an anomaly. Rectify the situation by having sort_and_merge_range_set() fold out empty ranges. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Acked-by: Thomas Rast <trast@inf.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t4211-line-log.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/t/t4211-line-log.sh b/t/t4211-line-log.sh
index d98efb3c4e..e7a6e49965 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
'