779
}
780
}
781
782
+ if (!strcmp(var, "diff.algorithm")) {
783
+ long diff_algorithm;
784
+ if (!value)
785
+ return config_error_nonbool(var);
786
+ diff_algorithm = parse_algorithm_value(value);
787
+ if (diff_algorithm < 0)
788
+ return error(_("unknown value for config '%s': %s"),
789
+ var, value);
790
+ xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK;
791
+ xdl_opts |= diff_algorithm;
792
+ return 0;
793
+ }
794
+
795
if (git_diff_heuristic_config(var, value, cb) < 0)
796
return -1;
797
if (userdiff_config(var, value) < 0)
837
return 0;
838
}
839
840
+static int blame_diff_algorithm_minimal(const struct option *option,
841
+ const char *arg, int unset)
842
+{
843
+ int *opt = option->value;
844
+
845
+ BUG_ON_OPT_ARG(arg);
846
+
847
+ *opt &= ~XDF_DIFF_ALGORITHM_MASK;
848
+ if (!unset)
849
+ *opt |= XDF_NEED_MINIMAL;
850
+
851
+ return 0;
852
+}
853
+
854
+static int blame_diff_algorithm_callback(const struct option *option,
855
+ const char *arg, int unset)
856
+{
857
+ int *opt = option->value;
858
+ long value = parse_algorithm_value(arg);
859
+
860
+ BUG_ON_OPT_NEG(unset);
861
+
862
+ if (value < 0)
863
+ return error(_("option diff-algorithm accepts \"myers\", "
864
+ "\"minimal\", \"patience\" and \"histogram\""));
865
+
866
+ *opt &= ~XDF_DIFF_ALGORITHM_MASK;
867
+ *opt |= value;
868
+
869
+ return 0;
870
+}
871
+
872
static int is_a_rev(const char *name)
873
{
874
struct object_id oid;
960
OPT_BIT('s', NULL, &output_option, N_("suppress author name and timestamp (Default: off)"), OUTPUT_NO_AUTHOR),
961
OPT_BIT('e', "show-email", &output_option, N_("show author email instead of name (Default: off)"), OUTPUT_SHOW_EMAIL),
962
OPT_BIT('w', NULL, &xdl_opts, N_("ignore whitespace differences"), XDF_IGNORE_WHITESPACE),
963
+ OPT_CALLBACK_F(0, "diff-algorithm", &xdl_opts, N_("<algorithm>"),
964
+ N_("choose a diff algorithm"),
965
+ PARSE_OPT_NONEG, blame_diff_algorithm_callback),
966
OPT_STRING_LIST(0, "ignore-rev", &ignore_rev_list, N_("rev"), N_("ignore <rev> when blaming")),
967
OPT_STRING_LIST(0, "ignore-revs-file", &ignore_revs_file_list, N_("file"), N_("ignore revisions from <file>")),
968
OPT_BIT(0, "color-lines", &output_option, N_("color redundant metadata from previous line differently"), OUTPUT_COLOR_LINE),
969
OPT_BIT(0, "color-by-age", &output_option, N_("color lines by age"), OUTPUT_SHOW_AGE_WITH_COLOR),
922
- OPT_BIT(0, "minimal", &xdl_opts, N_("spend extra cycles to find better match"), XDF_NEED_MINIMAL),
970
+ OPT_CALLBACK_F(0, "minimal", &xdl_opts, NULL,
971
+ N_("spend extra cycles to find a better match"),
972
+ PARSE_OPT_NOARG | PARSE_OPT_HIDDEN, blame_diff_algorithm_minimal),
973
OPT_STRING('S', NULL, &revs_file, N_("file"), N_("use revisions from <file> instead of calling git-rev-list")),
974
OPT_STRING(0, "contents", &contents_from, N_("file"), N_("use <file>'s contents as the final image")),
975
OPT_CALLBACK_F('C', NULL, &opt, N_("score"), N_("find line copies within and across files"), PARSE_OPT_OPTARG, blame_copy_callback),