@matheusbsbs / matheus-bagliano / commits / a97e4075a1
Fork 0

Keep rename/rename conflicts of intermediate merges while doing recursive merge

This patch leaves the base name in the resulting intermediate tree, to propagate the conflict from intermediate merges up to the top-level merge. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Alex Riesen committed Mar 31, 2007 at 13:49 UTC a97e4075a16e0cbdf9c4aed736b5e762e035508b
1 file changed +31 -6
merge-recursive.c
+31 -6
@@ -278,8 +278,16 @@ static struct tree *git_write_tree(void)
278 {
279 struct tree *result = NULL;
280
281 - if (unmerged_index())
281 + if (unmerged_index()) {
282 + int i;
283 + output(0, "There are unmerged index entries:");
284 + for (i = 0; i < active_nr; i++) {
285 + struct cache_entry *ce = active_cache[i];
286 + if (ce_stage(ce))
287 + output(0, "%d %.*s", ce_stage(ce), ce_namelen(ce), ce->name);
288 + }
289 return NULL;
290 + }
291
292 if (!active_cache_tree)
293 active_cache_tree = cache_tree();
@@ -735,8 +743,19 @@ static void conflict_rename_rename(struct rename *ren1,
743 ren2_dst, branch1, dst_name2);
744 remove_file(0, ren2_dst, 0);
745 }
738 - update_stages(dst_name1, NULL, ren1->pair->two, NULL, 1);
739 - update_stages(dst_name2, NULL, NULL, ren2->pair->two, 1);
746 + if (index_only) {
747 + remove_file_from_cache(dst_name1);
748 + remove_file_from_cache(dst_name2);
749 + /*
750 + * Uncomment to leave the conflicting names in the resulting tree
751 + *
752 + * update_file(0, ren1->pair->two->sha1, ren1->pair->two->mode, dst_name1);
753 + * update_file(0, ren2->pair->two->sha1, ren2->pair->two->mode, dst_name2);
754 + */
755 + } else {
756 + update_stages(dst_name1, NULL, ren1->pair->two, NULL, 1);
757 + update_stages(dst_name2, NULL, NULL, ren2->pair->two, 1);
758 + }
759 while (delp--)
760 free(del[delp]);
761 }
@@ -852,10 +871,16 @@ static int process_renames(struct path_list *a_renames,
871 if (strcmp(ren1_dst, ren2_dst) != 0) {
872 clean_merge = 0;
873 output(1, "CONFLICT (rename/rename): "
855 - "Rename %s->%s in branch %s "
856 - "rename %s->%s in %s",
874 + "Rename \"%s\"->\"%s\" in branch \"%s\" "
875 + "rename \"%s\"->\"%s\" in \"%s\"%s",
876 src, ren1_dst, branch1,
858 - src, ren2_dst, branch2);
877 + src, ren2_dst, branch2,
878 + index_only ? " (left unresolved)": "");
879 + if (index_only) {
880 + remove_file_from_cache(src);
881 + update_file(0, ren1->pair->one->sha1,
882 + ren1->pair->one->mode, src);
883 + }
884 conflict_rename_rename(ren1, branch1, ren2, branch2);
885 } else {
886 struct merge_file_info mfi;