diff: add option to skip resolving diff statuses
By default, `diffcore_std()` resolves the statuses for queued diff file pairs by calling `diff_resolve_rename_copy()`. If status information is already manually set, invoking `diffcore_std()` may change the status value. Introduce the `skip_resolving_statuses` diff option that prevents `diffcore_std()` from resolving file pair statuses when enabled. Signed-off-by: Justin Tobler <jltobler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Justin Tobler committed
Feb 28, 2025 at 15:33 UTC
c8a8e04099a99d6eafbe6e9bb1db3b50996836f8
2 files changed
+9
-1
diff.c
+1
-1
@@ -7085,7 +7085,7 @@ void diffcore_std(struct diff_options *options)
7085
diffcore_order(options->orderfile);
7086
if (options->rotate_to)
7087
diffcore_rotate(options);
7088
- if (!options->found_follow)
7088
+ if (!options->found_follow && !options->skip_resolving_statuses)
7089
/* See try_to_follow_renames() in tree-diff.c */
7090
diff_resolve_rename_copy();
7091
diffcore_apply_filter(options);
diff.h
+8
@@ -353,6 +353,14 @@ struct diff_options {
353
/* to support internal diff recursion by --follow hack*/
354
int found_follow;
355
356
+ /*
357
+ * By default, diffcore_std() resolves the statuses for queued diff file
358
+ * pairs by calling diff_resolve_rename_copy(). If status information
359
+ * has already been manually set, this option prevents diffcore_std()
360
+ * from resetting statuses.
361
+ */
362
+ int skip_resolving_statuses;
363
+
364
/* Callback which allows tweaking the options in diff_setup_done(). */
365
void (*set_default)(struct diff_options *);
366