range_set: fix coalescing bug when range is a subset of another
commit3755b53af779ce75fa3ea4581a0e6525bc67278d
authorEric Sunshine <sunshine@sunshineco.com>
Tue, 9 Jul 2013 05:55:05 +0000 (9 01:55 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 9 Jul 2013 16:25:04 +0000 (9 09:25 -0700)
treed9cad5bafb9d6c1dd2482478103fe2af8e00e348
parent18d472db6fe3909537ceb7e0c54cf01fa3466b8f
range_set: fix coalescing bug when range is a subset of another

When coalescing ranges, sort_and_merge_range_set() unconditionally
assumes that the end of a range being folded into a preceding range
should become the end of the coalesced range. This assumption, however,
is invalid when one range is a subset of another.  For example, given
ranges 1-5 and 2-3 added via range_set_append_unsafe(),
sort_and_merge_range_set() incorrectly coalesces them to range 1-3
rather than the correct union range 1-5. Fix this bug.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
line-log.c
t/t4211-line-log.sh