From ea180b80e8ba9da7bce84c12175343b964363688 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 18 Feb 2008 03:36:33 +0100 Subject: [PATCH] Avoid generating no-op conflicts. --- ChangeLog | 5 +++++ lib/git-merge-changelog.c | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 437e4a111..386eaf593 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2008-02-17 Bruno Haible + * lib/git-merge-changelog.c (main) [split_merged_entry]: Avoid + generating no-op conflicts. + +2008-02-17 Bruno Haible + Speed up by 10%. * lib/git-merge-changelog.c (main): Use the iterator to iterate through result_entries, rather than an index-based loop. diff --git a/lib/git-merge-changelog.c b/lib/git-merge-changelog.c index 56e551102..1911c08e5 100644 --- a/lib/git-merge-changelog.c +++ b/lib/git-merge-changelog.c @@ -1257,7 +1257,8 @@ There is NO WARRANTY, to the extent permitted by law.\n\ result_entries_pointers[k], changed_entry); } - else + else if (!entry_equals (ancestor_file.entries[i], + changed_entry)) { struct conflict *c = XMALLOC (struct conflict); c->num_old_entries = 1; @@ -1337,7 +1338,10 @@ There is NO WARRANTY, to the extent permitted by law.\n\ } else { - struct conflict *c = XMALLOC (struct conflict); + struct conflict *c; + ASSERT (!entry_equals (ancestor_file.entries[i], + changed_entry)); + c = XMALLOC (struct conflict); c->num_old_entries = 1; c->old_entries = XNMALLOC (c->num_old_entries, struct entry *); @@ -1399,7 +1403,10 @@ There is NO WARRANTY, to the extent permitted by law.\n\ } else { - struct conflict *c = XMALLOC (struct conflict); + struct conflict *c; + ASSERT (!entry_equals (ancestor_file.entries[i], + changed_entry)); + c = XMALLOC (struct conflict); c->num_old_entries = 1; c->old_entries = XNMALLOC (c->num_old_entries, struct entry *); -- 2.11.0