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

Re: [PATCH 3/4] diff: replace diff_options.dry_run flag with NULL file

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 24, 2025, 17:22 UTC
Message-ID
<xmqqcy6cp637.fsf@gitster.g>
In-Reply-To
<20251024170853.GC2345184@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 14 quoted lines
> We introduced a dry_run flag to diff_options in b55e6d36eb (diff: ensure
> consistent diff behavior with ignore options, 2025-08-08), with the idea
> that the lower-level diff code could skip output when it is set.
>
> As we saw with the bugs fixed by 3ed5d8bd73 (diff: stop output garbled
> message in dry run mode, 2025-10-20), it is easy to miss spots. In the
> end, we located all of them by checking where diff_options.file is used.
>
> That suggests another possible approach: we can replace the dry_run
> boolean with a NULL pointer for "file", as we know that using "file" in
> dry_run mode would always be an error. This turns any missed spots from
> producing extra output[1] into a segfault. Which is less forgiving, but
> that is the point: this is indicative of a programming error, and
> complaining loudly and immediately is good.
Makes sense.
Previous: Jeff KingNext: Jeff King
Message 5 of 7 in “diff dry-run cleanups”
  1. 0/4 diff dry-run cleanupsJeff King, Oct 24, 2025
  2. 1/4 diff: send external diff output to diff_options.fileJeff King, Oct 24, 2025
  3. 2/4 diff: drop save/restore of color_moved in dry-run modeJeff King, Oct 24, 2025
  4. 3/4 diff: replace diff_options.dry_run flag with NULL fileJeff King, Oct 24, 2025
  5. Junio C HamanoOct 24, 2025
  6. 4/4 diff: drop dry-run redirection to /dev/nullJeff King, Oct 24, 2025
  7. 5/4 diff: simplify run_external_diff() quiet logicJeff King, Oct 24, 2025

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.