3398
line_prefix, meta, reset);
3399
}
3400
3401
+static int diff_filepair_is_phoney(struct diff_filespec *one,
3402
+ struct diff_filespec *two)
3403
+{
3404
+ /*
3405
+ * This function specifically looks for pairs injected by
3406
+ * create_filepairs_for_header_only_notifications(). Such
3407
+ * pairs are "phoney" in that they do not represent any
3408
+ * content or even mode difference, but were inserted because
3409
+ * diff_queued_diff previously had no pair associated with
3410
+ * that path but we needed some pair to avoid losing the
3411
+ * "remerge CONFLICT" header associated with the path.
3412
+ */
3413
+ return !DIFF_FILE_VALID(one) && !DIFF_FILE_VALID(two);
3414
+}
3415
+
3416
static void builtin_diff(const char *name_a,
3417
const char *name_b,
3418
struct diff_filespec *one,
3444
3445
if (o->submodule_format == DIFF_SUBMODULE_LOG &&
3446
(!one->mode || S_ISGITLINK(one->mode)) &&
3432
- (!two->mode || S_ISGITLINK(two->mode))) {
3447
+ (!two->mode || S_ISGITLINK(two->mode)) &&
3448
+ (!diff_filepair_is_phoney(one, two))) {
3449
show_submodule_diff_summary(o, one->path ? one->path : two->path,
3450
&one->oid, &two->oid,
3451
two->dirty_submodule);
3452
return;
3453
} else if (o->submodule_format == DIFF_SUBMODULE_INLINE_DIFF &&
3454
(!one->mode || S_ISGITLINK(one->mode)) &&
3439
- (!two->mode || S_ISGITLINK(two->mode))) {
3455
+ (!two->mode || S_ISGITLINK(two->mode)) &&
3456
+ (!diff_filepair_is_phoney(one, two))) {
3457
show_submodule_inline_diff(o, one->path ? one->path : two->path,
3458
&one->oid, &two->oid,
3459
two->dirty_submodule);
3473
b_two = quote_two(b_prefix, name_b + (*name_b == '/'));
3474
lbl[0] = DIFF_FILE_VALID(one) ? a_one : "/dev/null";
3475
lbl[1] = DIFF_FILE_VALID(two) ? b_two : "/dev/null";
3459
- if (!DIFF_FILE_VALID(one) && !DIFF_FILE_VALID(two)) {
3476
+ if (diff_filepair_is_phoney(one, two)) {
3477
/*
3461
- * We should only reach this point for pairs from
3478
+ * We should only reach this point for pairs generated from
3479
* create_filepairs_for_header_only_notifications(). For
3463
- * these, we should avoid the "/dev/null" special casing
3464
- * above, meaning we avoid showing such pairs as either
3480
+ * these, we want to avoid the "/dev/null" special casing
3481
+ * above, because we do not want such pairs shown as either
3482
* "new file" or "deleted file" below.
3483
*/
3484
lbl[0] = a_one;