[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: git-merge-changelog question
From: |
Bruno Haible |
Subject: |
Re: git-merge-changelog question |
Date: |
Sat, 4 Jul 2009 11:26:08 +0200 |
User-agent: |
KMail/1.9.9 |
Eric Blake wrote:
> This time, git removes the temporary .merge_file_*, but I confirmed that
> they can be recreated via:
>
> $ git show 5f008b:ChangeLog > file1
> $ git show 0b17f4:ChangeLog > file2
> $ git show cd172d:ChangeLog > file3
> $ git-merge-changelog --split-merged-entry file[123]
Thanks again for this reproducible example. This fixes it:
2009-07-04 Bruno Haible <address@hidden>
Fix assertion.
* lib/git-merge-changelog.c (compute_mapping): In the case where file1
contains more exact copies of a given entry than file2, leave the extra
copies unpaired rather than aborting.
Reported by Eric Blake.
*** lib/git-merge-changelog.c.orig 2009-07-04 11:21:00.000000000 +0200
--- lib/git-merge-changelog.c 2009-07-04 11:19:29.000000000 +0200
***************
*** 510,546 ****
{
j = n2 - 1 - j;
/* Found an exact correspondence. */
! ASSERT (index_mapping_reverse[j] < 0);
! index_mapping[i] = j;
! index_mapping_reverse[j] = i;
! /* Look for more occurrences of the same entry. */
! {
! ssize_t curr_i = i;
! ssize_t curr_j = j;
!
! for (;;)
{
! ssize_t next_i;
! ssize_t next_j;
! next_i =
! gl_list_indexof_from (file1->entries_reversed, n1 - curr_i,
! entry);
! if (next_i < 0)
! break;
! next_j =
! gl_list_indexof_from (file2->entries_reversed, n2 - curr_j,
! entry);
! if (next_j < 0)
! break;
! curr_i = n1 - 1 - next_i;
! curr_j = n2 - 1 - next_j;
! ASSERT (index_mapping[curr_i] < 0);
! ASSERT (index_mapping_reverse[curr_j] < 0);
! index_mapping[curr_i] = curr_j;
! index_mapping_reverse[curr_j] = curr_i;
}
! }
}
}
--- 510,553 ----
{
j = n2 - 1 - j;
/* Found an exact correspondence. */
! /* If index_mapping_reverse[j] >= 0, we have already seen other
! copies of this entry, and there were more occurrences of it in
! file1 than in file2. In this case, do nothing. */
! if (index_mapping_reverse[j] < 0)
! {
! index_mapping[i] = j;
! index_mapping_reverse[j] = i;
! /* Look for more occurrences of the same entry. Match them
! as long as they pair up. Unpaired occurrences of the same
! entry are left without mapping. */
{
! ssize_t curr_i = i;
! ssize_t curr_j = j;
!
! for (;;)
! {
! ssize_t next_i;
! ssize_t next_j;
! next_i =
! gl_list_indexof_from (file1->entries_reversed,
! n1 - curr_i, entry);
! if (next_i < 0)
! break;
! next_j =
! gl_list_indexof_from (file2->entries_reversed,
! n2 - curr_j, entry);
! if (next_j < 0)
! break;
! curr_i = n1 - 1 - next_i;
! curr_j = n2 - 1 - next_j;
! ASSERT (index_mapping[curr_i] < 0);
! ASSERT (index_mapping_reverse[curr_j] < 0);
! index_mapping[curr_i] = curr_j;
! index_mapping_reverse[curr_j] = curr_i;
! }
}
! }
}
}