aboutsummaryrefslogtreecommitdiffstats
path: root/xdiff-interface.h
diff options
context:
space:
mode:
authorLidong Yan <yldhome2d2@gmail.com>2025-08-08 11:30:19 +0800
committerJunio C Hamano <gitster@pobox.com>2025-08-08 07:54:44 -0700
commitb55e6d36ebce69136559add8fffd1a65df231518 (patch)
treeae8577be728c9ff7734cab37588b2434139b6958 /xdiff-interface.h
parentThe sixteenth batch (diff)
downloadgit-b55e6d36ebce69136559add8fffd1a65df231518.tar.gz
git-b55e6d36ebce69136559add8fffd1a65df231518.zip
diff: ensure consistent diff behavior with ignore options
In git-diff, options like `-w` and `-I<regex>`, two files are considered equivalent under the specified "ignore" rules, even when they are not bit-for-bit identical. For options like `--raw`, `--name-status`, and `--name-only`, git-diff deliberately compares only the SHA values to determine whether two files are equivalent, for performance reasons. As a result, a file shown in `git diff --name-status` may not appear in `git diff --patch`. To quickly determine whether two files are equivalent, add a helper function diff_flush_patch_quietly() in diff.c. Add `.dry_run` field in `struct diff_options`. When `.dry_run` is true, builtin_diff() returns immediately upon finding any change. Call diff_flush_patch_quietly() to determine if we should flush `--raw`, `--name-only` or `--name-status` output. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Lidong Yan <yldhome2d2@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rw-r--r--xdiff-interface.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/xdiff-interface.h b/xdiff-interface.h
index 1ed430b622..dfc55daddf 100644
--- a/xdiff-interface.h
+++ b/xdiff-interface.h
@@ -28,9 +28,9 @@
* from an error internal to xdiff, xdiff itself will see that
* non-zero return and translate it to -1.
*
- * See "diff_grep" in diffcore-pickaxe.c for a trick to work around
- * this, i.e. using the "consume_callback_data" to note the desired
- * early return.
+ * See "diff_grep" in diffcore-pickaxe.c and "quick_consume" in diff.c
+ * for a trick to work around this, i.e. using the "consume_callback_data"
+ * to note the desired early return.
*/
typedef int (*xdiff_emit_line_fn)(void *, char *, unsigned long);
typedef void (*xdiff_emit_hunk_fn)(void *data,