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 <gitster@pobox.com>
Junio C Hamano committed
Mar 17, 2011 at 22:22 UTC
b9b3eef76186d423efb684d01b3e99ef010a61de
1 file changed
+8
-1
merge-recursive.c
+8
-1
@@ -370,6 +370,13 @@ static void make_room_for_directories_of_df_conflicts(struct merge_options *o,
370
struct stage_data *last_e;
371
int i;
372
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
+
380
for (i = 0; i < entries->nr; i++) {
381
const char *path = entries->items[i].string;
382
int len = strlen(path);
@@ -1274,7 +1281,7 @@ static int merge_content(struct merge_options *o,
1281
1282
if (mfi.clean && !df_conflict_remains &&
1283
sha_eq(mfi.sha, a_sha) && mfi.mode == a.mode &&
1277
- lstat(path, &st) == 0) {
1284
+ !o->call_depth && !lstat(path, &st)) {
1285
output(o, 3, "Skipped %s (merged same as existing)", path);
1286
add_cacheinfo(mfi.mode, mfi.sha, path,
1287
0 /*stage*/, 1 /*refresh*/, 0 /*options*/);