aboutsummaryrefslogtreecommitdiffstats
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-10-24 10:15:09 -0700
committerJunio C Hamano <gitster@pobox.com>2025-10-24 10:15:09 -0700
commita7f01ac59b8caef906e0c4b39caf936d2756f064 (patch)
treee96b3a6e109c2b26790ff0b938497d7134a66639 /diff.c
parentThe twenty-third batch (diff)
parentdiff: stop output garbled message in dry run mode (diff)
downloadgit-a7f01ac59b8caef906e0c4b39caf936d2756f064.tar.gz
git-a7f01ac59b8caef906e0c4b39caf936d2756f064.zip
Merge branch 'ly/diff-name-only-with-diff-from-content' into jk/diff-patch-dry-run-cleanup
* ly/diff-name-only-with-diff-from-content: diff: stop output garbled message in dry run mode
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/diff.c b/diff.c
index a74e701806..22415aecee 100644
--- a/diff.c
+++ b/diff.c
@@ -1351,6 +1351,9 @@ static void emit_diff_symbol_from_struct(struct diff_options *o,
int len = eds->len;
unsigned flags = eds->flags;
+ if (o->dry_run)
+ return;
+
switch (s) {
case DIFF_SYMBOL_NO_LF_EOF:
context = diff_get_color_opt(o, DIFF_CONTEXT);
@@ -4420,7 +4423,7 @@ static void run_external_diff(const struct external_diff *pgm,
{
struct child_process cmd = CHILD_PROCESS_INIT;
struct diff_queue_struct *q = &diff_queued_diff;
- int quiet = !(o->output_format & DIFF_FORMAT_PATCH);
+ int quiet = !(o->output_format & DIFF_FORMAT_PATCH) || o->dry_run;
int rc;
/*
@@ -4615,7 +4618,8 @@ static void run_diff_cmd(const struct external_diff *pgm,
p->status == DIFF_STATUS_RENAMED)
o->found_changes = 1;
} else {
- fprintf(o->file, "* Unmerged path %s\n", name);
+ if (!o->dry_run)
+ fprintf(o->file, "* Unmerged path %s\n", name);
o->found_changes = 1;
}
}