{"thread":{"id":"28550","subject":"[PATCH] diff: resurrect XDF_NEED_MINIMAL with --minimal","startedAt":"2011-10-02T05:04:27Z","lastAt":"2011-10-03T13:04:28Z","messageCount":3,"participants":["Junio C Hamano","Jonathan Nieder","Tay Ray Chuan"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"176675","messageId":"7voby0j86c.fsf@alter.siamese.dyndns.org","threadId":"28550","inReplyTo":null,"subject":"[PATCH] diff: resurrect XDF_NEED_MINIMAL with --minimal","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-10-02T05:04:27Z","receivedAt":"2011-10-02T05:04:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Earlier, 582aa00 (git diff too slow for a file, 2010-05-02)\nunconditionally dropped XDF_NEED_MINIMAL option from the internal xdiff\ninvocation to help performance on pathological cases, while hinting that a\nfollow-up patch could reintroduce it with \"--minimal\" option from the\ncommand line.\n\nMake it so.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n * This together with René's c5aa906 (Revert removal of multi-match\n   discard heuristic in 27af01, 2011-09-25) on top of v1.7.7 seems to give\n   identical diff output as v1.7.1 (e.g. \"git diff-tree -p v2.6.39 v3.0\"\n   in the kernel repository, with \"--minimal\").\n\n diff.c |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex 93ef9a2..34a88db 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -3511,6 +3511,10 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)\n \t}\n \telse if (!strcmp(arg, \"--abbrev\"))\n \t\toptions->abbrev = DEFAULT_ABBREV;\n+\telse if (!strcmp(arg, \"--minimal\"))\n+\t\tDIFF_XDL_SET(options, NEED_MINIMAL);\n+\telse if (!strcmp(arg, \"--no-minimal\"))\n+\t\tDIFF_XDL_CLR(options, NEED_MINIMAL);\n \telse if (!prefixcmp(arg, \"--abbrev=\")) {\n \t\toptions->abbrev = strtoul(arg + 9, NULL, 10);\n \t\tif (options->abbrev < MINIMUM_ABBREV)\n-- \n1.7.7\n"},{"id":"176740","messageId":"20111003123843.GA15493@elie","threadId":"28550","inReplyTo":"7voby0j86c.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] diff: resurrect XDF_NEED_MINIMAL with --minimal","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-10-03T12:38:43Z","receivedAt":"2011-10-03T12:38:43Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n\n>  * This together with René's c5aa906 (Revert removal of multi-match\n>    discard heuristic in 27af01, 2011-09-25) on top of v1.7.7 seems to give\n>    identical diff output as v1.7.1 (e.g. \"git diff-tree -p v2.6.39 v3.0\"\n>    in the kernel repository, with \"--minimal\").\n\nVery neat.\n\n> --- a/diff.c\n> +++ b/diff.c\n> @@ -3511,6 +3511,10 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)\n>  \t}\n>  \telse if (!strcmp(arg, \"--abbrev\"))\n>  \t\toptions->abbrev = DEFAULT_ABBREV;\n> +\telse if (!strcmp(arg, \"--minimal\"))\n> +\t\tDIFF_XDL_SET(options, NEED_MINIMAL);\n> +\telse if (!strcmp(arg, \"--no-minimal\"))\n> +\t\tDIFF_XDL_CLR(options, NEED_MINIMAL);\n>  \telse if (!prefixcmp(arg, \"--abbrev=\")) {\n\nI think this would fit well near --patience (the \"xdiff options\"\nsection), instead of hidden between the unsticked and sticked forms of\n--abbrev. ;-)\n\nLike this:\n\ndiff --git i/Documentation/diff-options.txt w/Documentation/diff-options.txt\nindex b620b3af..4d87256e 100644\n--- i/Documentation/diff-options.txt\n+++ w/Documentation/diff-options.txt\n@@ -48,6 +48,10 @@ endif::git-format-patch[]\n --patience::\n \tGenerate a diff using the \"patience diff\" algorithm.\n \n+--minimal::\n+\tSpend extra time to make sure the smallest possible\n+\tdiff is produced.\n+\n --stat[=<width>[,<name-width>[,<count>]]]::\n \tGenerate a diffstat.  You can override the default\n \toutput width for 80-column terminal by `--stat=<width>`.\ndiff --git i/diff.c w/diff.c\nindex fcc00780..2282f86f 100644\n--- i/diff.c\n+++ w/diff.c\n@@ -3393,6 +3393,10 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)\n \t\tDIFF_XDL_SET(options, IGNORE_WHITESPACE_AT_EOL);\n \telse if (!strcmp(arg, \"--patience\"))\n \t\tDIFF_XDL_SET(options, PATIENCE_DIFF);\n+\telse if (!strcmp(arg, \"--minimal\"))\n+\t\tDIFF_XDL_SET(options, NEED_MINIMAL);\n+\telse if (!strcmp(arg, \"--no-minimal\"))\n+\t\tDIFF_XDL_CLR(options, NEED_MINIMAL);\n \telse if (!strcmp(arg, \"--histogram\"))\n \t\tDIFF_XDL_SET(options, HISTOGRAM_DIFF);\n \n"},{"id":"176742","messageId":"CALUzUxrfUF5sbgSv3dwkBC6cggV3mqRDDMrpP-zX_86xdt6ZYA@mail.gmail.com","threadId":"28550","inReplyTo":"20111003123843.GA15493@elie","subject":"Re: [PATCH] diff: resurrect XDF_NEED_MINIMAL with --minimal","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2011-10-03T13:04:28Z","receivedAt":"2011-10-03T13:04:28Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"On Mon, Oct 3, 2011 at 8:38 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n\nThanks for the Cc, Johnathan.\n\n> Junio C Hamano wrote:\n>\n>>  * This together with René's c5aa906 (Revert removal of multi-match\n>>    discard heuristic in 27af01, 2011-09-25) on top of v1.7.7 seems to give\n>>    identical diff output as v1.7.1 (e.g. \"git diff-tree -p v2.6.39 v3.0\"\n>>    in the kernel repository, with \"--minimal\").\n>\n> Very neat.\n\nInteresting. Clearly there is more than just the multi-match discard\nheuristic in (xdl_clean_mmatch() and xdl_cleanup_records()).\n\n> diff --git i/diff.c w/diff.c\n> index fcc00780..2282f86f 100644\n> --- i/diff.c\n> +++ w/diff.c\n> @@ -3393,6 +3393,10 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)\n>                DIFF_XDL_SET(options, IGNORE_WHITESPACE_AT_EOL);\n>        else if (!strcmp(arg, \"--patience\"))\n>                DIFF_XDL_SET(options, PATIENCE_DIFF);\n> +       else if (!strcmp(arg, \"--minimal\"))\n> +               DIFF_XDL_SET(options, NEED_MINIMAL);\n> +       else if (!strcmp(arg, \"--no-minimal\"))\n> +               DIFF_XDL_CLR(options, NEED_MINIMAL);\n>        else if (!strcmp(arg, \"--histogram\"))\n>                DIFF_XDL_SET(options, HISTOGRAM_DIFF);\n>\n>\n\nThat's an improvement, but it would be even better if it was placed\nabove the --<strategy> options, instead of being placed between them.\n\n-- \nCheers,\nRay Chuan\n"}]}