@matheusbsbs / matheus-bagliano / commits / 3d234d0afa
Fork 0

merge-recursive: fix rename handling

To handle renames properly, we iterate through all file names of both heads, the current one, and the one to be merged. Only that there was a bug, where it was checked if the file name was present in both heads, but the result of the check was never used. Instead, the merge proceeded as if both heads contained that file. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>

Johannes Schindelin committed Aug 4, 2006 at 18:21 UTC 3d234d0afacd355eb30b330a56bd2efa73bd44d5
1 file changed +4 -2
merge-recursive.c
+4 -2
@@ -810,8 +810,10 @@ static int process_renames(struct path_list *a_renames,
810 } else {
811 compare = strcmp(a_renames->items[i].path,
812 b_renames->items[j].path);
813 - ren1 = a_renames->items[i++].util;
814 - ren2 = b_renames->items[j++].util;
813 + if (compare <= 0)
814 + ren1 = a_renames->items[i++].util;
815 + if (compare >= 0)
816 + ren2 = b_renames->items[j++].util;
817 }
818
819 /* TODO: refactor, so that 1/2 are not needed */