X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fgit-merge-changelog.c;h=22d2bfd41e9aa3580728c228ee88b78fa38aaaeb;hb=fcfced6a46fa2b6c8dd701264d852d254f9fd042;hp=56e5511024fa543a7c9941c40e3c0899e9d4499e;hpb=0eb77fc848fa25c1bc36cc82908655c32ae73702;p=gnulib.git diff --git a/lib/git-merge-changelog.c b/lib/git-merge-changelog.c index 56e551102..22d2bfd41 100644 --- a/lib/git-merge-changelog.c +++ b/lib/git-merge-changelog.c @@ -21,7 +21,7 @@ default merge driver has no clue how to deal with this. Furthermore the conflicts are presented with more <<<< ==== >>>> markers than necessary; this is because the default merge driver makes pointless - effects to look at the individual line changes inside a ChangeLog entry. + efforts to look at the individual line changes inside a ChangeLog entry. This program serves as a 'git' merge driver that avoids these problems. 1. It produces no conflict when ChangeLog entries have been inserted @@ -186,7 +186,7 @@ entry_equals (const void *elt1, const void *elt2) const struct entry *entry2 = (const struct entry *) elt2; return entry1->length == entry2->length && memcmp (entry1->string, entry2->string, entry1->length) == 0; -}; +} /* Return a hash code of the contents of a ChangeLog entry. */ static size_t @@ -808,7 +808,7 @@ conflict_write (FILE *fp, struct conflict *c) /* Long options. */ static const struct option long_options[] = -{ +{ { "help", no_argument, NULL, 'h' }, { "split-merged-entry", no_argument, NULL, CHAR_MAX + 1 }, { "version", no_argument, NULL, 'V' }, @@ -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 *);