threads / patch / 5123

patchmerge-recursive: fix rename handling

Subject: [PATCH] merge-recursive: fix rename handling

## tl;dr

One message between Aug 4, 2006 and Aug 4, 2006. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Johannes Schindelin· Aug 4, 2006, 16:21 UTC · lore

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>
---
 merge-recursive.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
Show changes to merge-recursive.c +4 −2
diff --git a/merge-recursive.c b/merge-recursive.c
index 10bce70..1e176ca 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -808,8 +808,10 @@ static int process_renames(struct path_l
 		} 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 */
-- 
1.4.2.rc2.ga8a2

← back to recent threads