range-diff: respect diff_option.file rather than assuming 'stdout'
authorEric Sunshine <sunshine@sunshineco.com>
Sun, 22 Jul 2018 09:57:10 +0000 (05:57 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 14 Aug 2018 21:24:56 +0000 (14:24 -0700)
The actual diffs output by range-diff respect diff_option.file, which
range-diff passes down the call-chain, thus are destination-agnostic.
However, output_pair_header() is hard-coded to emit to 'stdout'. Fix
this by making output_pair_header() respect diff_option.file, as well.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
range-diff.c
index b6b9abac266f3a6a2abdfcdd815f80b7da930854..defe31f095e492632b11ad34f762a1e34cf7c96c 100644 (file)
@@ -323,7 +323,7 @@ static void output_pair_header(struct diff_options *diffopt,
        }
        strbuf_addf(buf, "%s\n", color_reset);
 
-       fwrite(buf->buf, buf->len, 1, stdout);
+       fwrite(buf->buf, buf->len, 1, diffopt->file);
 }
 
 static struct userdiff_driver no_func_name = {