merge-recursive: Avoid working directory changes during recursive case

make_room_for_directories_of_df_conflicts() is about making sure necessary working directory changes can succeed. When o->call_depth > 0 (i.e. the recursive case), we do not want to make any working directory changes so this function should be skipped. Note that make_room_for_directories_of_df_conflicts() is broken as has been pointed out by Junio; it should NOT be unlinking files. What it should do is keep track of files that could be unlinked if a directory later needs to be written in their place. However, that work also is only relevant in the non-recursive case, so this change is helpful either way. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Aug 11, 2011 at 23:19 UTC 0b30e8125130a78bc7c0e13e7f45ba105bd206b8
1 file changed +7
merge-recursive.c
+7
@@ -353,6 +353,13 @@ static void make_room_for_directories_of_df_conflicts(struct merge_options *o,
353 int last_len = 0;
354 int i;
355
356 + /*
357 + * If we're merging merge-bases, we don't want to bother with
358 + * any working directory changes.
359 + */
360 + if (o->call_depth)
361 + return;
362 +
363 for (i = 0; i < entries->nr; i++) {
364 const char *path = entries->items[i].string;
365 int len = strlen(path);