Skip to content

Commit b9b3eef

Browse files
committed
merge-recursive: tweak magic band-aid
Running checks against working tree (e.g. lstat()) and causing changes to working tree (e.g. unlink()) while building a virtual ancestor merge does not make any sense. Avoid doing so. This is not a real fix; it is another magic band-aid on top of another band-aid we placed earlier. Signed-off-by: Junio C Hamano <[email protected]>
1 parent b2c8c0a commit b9b3eef

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

merge-recursive.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,13 @@ static void make_room_for_directories_of_df_conflicts(struct merge_options *o,
370370
struct stage_data *last_e;
371371
int i;
372372

373+
/*
374+
* Do not do any of this crazyness during the recursive; we don't
375+
* even write anything to the working tree!
376+
*/
377+
if (o->call_depth)
378+
return;
379+
373380
for (i = 0; i < entries->nr; i++) {
374381
const char *path = entries->items[i].string;
375382
int len = strlen(path);
@@ -1274,7 +1281,7 @@ static int merge_content(struct merge_options *o,
12741281

12751282
if (mfi.clean && !df_conflict_remains &&
12761283
sha_eq(mfi.sha, a_sha) && mfi.mode == a.mode &&
1277-
lstat(path, &st) == 0) {
1284+
!o->call_depth && !lstat(path, &st)) {
12781285
output(o, 3, "Skipped %s (merged same as existing)", path);
12791286
add_cacheinfo(mfi.mode, mfi.sha, path,
12801287
0 /*stage*/, 1 /*refresh*/, 0 /*options*/);

0 commit comments

Comments
 (0)