Skip to content

Commit 81b568c

Browse files
committed
diff: resurrect XDF_NEED_MINIMAL with --minimal
Earlier, 582aa00 (git diff too slow for a file, 2010-05-02) unconditionally dropped XDF_NEED_MINIMAL option from the internal xdiff invocation to help performance on pathological cases, while hinting that a follow-up patch could reintroduce it with "--minimal" option from the command line. Make it so. Signed-off-by: Junio C Hamano <[email protected]>
1 parent c5aa906 commit 81b568c

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Documentation/diff-options.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ ifndef::git-format-patch[]
4545
Synonym for `-p --raw`.
4646
endif::git-format-patch[]
4747

48+
--minimal::
49+
Spend extra time to make sure the smallest possible
50+
diff is produced.
51+
4852
--patience::
4953
Generate a diff using the "patience diff" algorithm.
5054

diff.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3385,6 +3385,10 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
33853385
}
33863386

33873387
/* xdiff options */
3388+
else if (!strcmp(arg, "--minimal"))
3389+
DIFF_XDL_SET(options, NEED_MINIMAL);
3390+
else if (!strcmp(arg, "--no-minimal"))
3391+
DIFF_XDL_CLR(options, NEED_MINIMAL);
33883392
else if (!strcmp(arg, "-w") || !strcmp(arg, "--ignore-all-space"))
33893393
DIFF_XDL_SET(options, IGNORE_WHITESPACE);
33903394
else if (!strcmp(arg, "-b") || !strcmp(arg, "--ignore-space-change"))

0 commit comments

Comments
 (0)