merge-recursive: Avoid working directory changes during recursive case
authorElijah Newren <newren@gmail.com>
Fri, 12 Aug 2011 05:19:54 +0000 (23:19 -0600)
committerJunio C Hamano <gitster@pobox.com>
Sun, 14 Aug 2011 21:19:34 +0000 (14:19 -0700)
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>
merge-recursive.c

index f172df1695f0c1a06b205fb43295a58192dcd33a..e6a6a81ec28b531031aa50ee5374a05c0a890137 100644 (file)
@@ -353,6 +353,13 @@ static void make_room_for_directories_of_df_conflicts(struct merge_options *o,
        int last_len = 0;
        int i;
 
+       /*
+        * If we're merging merge-bases, we don't want to bother with
+        * any working directory changes.
+        */
+       if (o->call_depth)
+               return;
+
        for (i = 0; i < entries->nr; i++) {
                const char *path = entries->items[i].string;
                int len = strlen(path);