Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/dmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ static int diff_bisect(
static int diff_cleanup_merge(dmp_diff *diff, dmp_range *list)
{
dmp_pool *pool = &diff->pool;
int i, before, common, changes;
int i, j, before, common, changes;
int count_delete, count_insert, len_delete, len_insert;
dmp_node *ins = NULL, *del = NULL, *last = NULL, *node, *next;

Expand All @@ -394,8 +394,9 @@ static int diff_cleanup_merge(dmp_diff *diff, dmp_range *list)
* that can be extracted
*/

for (i = list->start; i != -1; i = node->next) {
for (i = list->start; i != -1; i = j) {
node = dmp_node_at(pool, i);
j = node->next;

switch (node->op) {
case DMP_DIFF_INSERT:
Expand Down
6 changes: 6 additions & 0 deletions test/dmp_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ void test_diff_0(void)
dmp_diff_print_raw(stderr, diff);
expect_diff_stat(diff, 1, 1, 1, 0x5); /* 0101 */
dmp_diff_free(diff);

dmp_diff_from_strs(&diff, NULL, "a\nbcde\n\n", "A\nbcdefghijklmnopqrst\n\n");
assert(diff != NULL);
dmp_diff_print_raw(stderr, diff);
expect_diff_stat(diff, 1, 2, 2, 0x1a); /* 11010 */
dmp_diff_free(diff);
}


Expand Down