X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=diff.c;h=f91f256c56e5e4be0b3f162695e1d35e63124569;hb=f6276b788f26c3c148c2d5465a6b03fc09bb785c;hp=781fa15ac13ce11f8b77b95665659cfcbcab5836;hpb=edb7e82f72106add9f2fbaf9d99d9532a72e3f91;p=git.git diff --git a/diff.c b/diff.c index 781fa15ac..f91f256c5 100644 --- a/diff.c +++ b/diff.c @@ -1465,6 +1465,10 @@ static void builtin_diff(const char *name_a, const char *set = diff_get_color_opt(o, DIFF_METAINFO); const char *reset = diff_get_color_opt(o, DIFF_RESET); + /* Never use a non-valid filename anywhere if at all possible */ + name_a = DIFF_FILE_VALID(one) ? name_a : name_b; + name_b = DIFF_FILE_VALID(two) ? name_b : name_a; + a_one = quote_two(o->a_prefix, name_a + (*name_a == '/')); b_two = quote_two(o->b_prefix, name_b + (*name_b == '/')); lbl[0] = DIFF_FILE_VALID(one) ? a_one : "/dev/null";