diff options
| author | Lidong Yan <yldhome2d2@gmail.com> | 2025-10-20 00:30:24 +0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-10-23 09:06:52 -0700 |
| commit | 3ed5d8bd7366076fd049e735e363e5a77656743c (patch) | |
| tree | 384e5b578005f7224eecdbf1cca5e4a241ce0979 /t/unit-tests/clar/example/example.c | |
| parent | 0adac327a7b70ed0d0c17e0c509198446c79666e (diff) | |
diff: stop output garbled message in dry run mode
Earlier, b55e6d36 (diff: ensure consistent diff behavior with
ignore options, 2025-08-08) introduced "dry-run" mode to the
diff machinery so that content-based diff filtering (like
ignoring space changes or those that match -I<regex>) can first
try to produce a patch without emitting any output to see if
under the given diff filtering condition we would get any output
lines, and a new helper function diff_flush_patch_quietly() was
introduced to use the mode to see an individual filepair needs
to be shown.
However, the solution was not complete. When files are deleted,
file modes change, or there are unmerged entries in the index,
dry-run mode still produces output because we overlooked these
conditions, and as a result, dry-run mode was not quiet.
To fix this, return early in emit_diff_symbol_from_struct() if
we are in dry-run mode. This function will be called by all the
emit functions to output the results. Returning early can avoid
diff output when files are deleted or file modes are changed.
Stop print message in dry-run mode if we have unmerged entries
in index. Discard output of external diff tool in dry-run mode.
Signed-off-by: Lidong Yan <yldhome2d2@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/unit-tests/clar/example/example.c')
0 files changed, 0 insertions, 0 deletions
