]> asedeno.scripts.mit.edu Git - git.git/commitdiff
merge-recursive: fix rename handling
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>
Fri, 4 Aug 2006 16:21:41 +0000 (18:21 +0200)
committerJunio C Hamano <junkio@cox.net>
Fri, 4 Aug 2006 18:30:35 +0000 (11:30 -0700)
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>
merge-recursive.c

index 74a329faa5f35c24bcd61271d635dca26778c19e..f5c0080a512e4dfe8c74426bf559d13f2b7eaf2f 100644 (file)
@@ -810,8 +810,10 @@ static int process_renames(struct path_list *a_renames,
                } else {
                        compare = strcmp(a_renames->items[i].path,
                                        b_renames->items[j].path);
-                       ren1 = a_renames->items[i++].util;
-                       ren2 = b_renames->items[j++].util;
+                       if (compare <= 0)
+                               ren1 = a_renames->items[i++].util;
+                       if (compare >= 0)
+                               ren2 = b_renames->items[j++].util;
                }
 
                /* TODO: refactor, so that 1/2 are not needed */