summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-10-30 08:00:19 -0700
committerJunio C Hamano <gitster@pobox.com>2025-10-30 08:00:20 -0700
commit27a1735807f64fb40fa20187a7dba9779d51fd5a (patch)
tree7f09fd13ea406610ccd71c4cddf490daeebb2fbc /diff.c
parent55547380384c77071b2fc8ff4cc570434a4793d1 (diff)
parent3ed5d8bd7366076fd049e735e363e5a77656743c (diff)
Merge branch 'ly/diff-name-only-with-diff-from-content'
Regression fixes for a topic that has already been merged. * 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;
}
}