git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] combine-diff: abort if --output is given

From
René Scharfe <l.s.r@web.de>
Date
Jun 18, 2022, 11:12 UTC
Message-ID
<493bbdb3-be73-9aa2-e3f6-82508d15ef88@web.de>
In-Reply-To
<220524.86v8tuvfl1.gmgdl@evledraar.gmail.com>

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>
---
 combine-diff.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/combine-diff.c b/combine-diff.c
index 11df1d7f39..b0ece95480 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -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)
--
2.36.1
Previous: Junio C Hamano
Message 12 of 12 in “Bug: combined diff with --ignore-matching-lines”
  1. René ScharfeMay 14, 2022
  2. diff: fix a segfault in >2 tree -I<regex> and --output=<file>Ævar Arnfjörð Bjarmason, May 23, 2022
  3. Junio C HamanoMay 23, 2022
  4. Ævar Arnfjörð BjarmasonMay 24, 2022
  5. Junio C HamanoMay 24, 2022
  6. Ævar Arnfjörð BjarmasonMay 24, 2022
  7. René ScharfeJun 18, 2022
  8. 1/2 combine-diff: abort if --ignore-matching-lines is givenRené Scharfe, Jun 18, 2022
  9. Junio C HamanoJun 21, 2022
  10. René ScharfeJun 21, 2022
  11. Junio C HamanoJun 21, 2022
  12. 2/2 combine-diff: abort if --output is givenRené Scharfe, Jun 18, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.