]> git.ipfire.org Git - thirdparty/git.git/commitdiff
combine-diff: abort if --output is given
authorRené Scharfe <l.s.r@web.de>
Sat, 18 Jun 2022 11:12:34 +0000 (13:12 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 21 Jun 2022 16:56:33 +0000 (09:56 -0700)
The code for combined diffs currently only writes to stdout.  Abort and
report that fact instead of silently ignoring the --output option.  The
(empty) output file has already been created at that point, though.

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
combine-diff.c

index 512897e3bfe8f9842cd397a1b670e878a5bbffcf..76d2351fce84daea4a5975b6e8727cb121b7ffe4 100644 (file)
@@ -1501,6 +1501,9 @@ void diff_tree_combined(const struct object_id *oid,
        if (opt->ignore_regex_nr)
                die("combined diff and '%s' cannot be used together",
                    "--ignore-matching-lines");
+       if (opt->close_file)
+               die("combined diff and '%s' cannot be used together",
+                   "--output");
 
        /* nothing to do, if no parents */
        if (!num_parent)