Skip to content

Commit c8a8e04

Browse files
jltoblergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7c67d2a commit c8a8e04

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7085,7 +7085,7 @@ void diffcore_std(struct diff_options *options)
70857085
diffcore_order(options->orderfile);
70867086
if (options->rotate_to)
70877087
diffcore_rotate(options);
7088-
if (!options->found_follow)
7088+
if (!options->found_follow && !options->skip_resolving_statuses)
70897089
/* See try_to_follow_renames() in tree-diff.c */
70907090
diff_resolve_rename_copy();
70917091
diffcore_apply_filter(options);

diff.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,14 @@ struct diff_options {
353353
/* to support internal diff recursion by --follow hack*/
354354
int found_follow;
355355

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+
356364
/* Callback which allows tweaking the options in diff_setup_done(). */
357365
void (*set_default)(struct diff_options *);
358366

0 commit comments

Comments
 (0)