diff-parseopt: convert --histogram

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Mar 5, 2019 at 19:30 UTC f1e68ef5616f868cc3789625ab278e4c3ece237d
1 file changed +4 -3
diff.c
+4 -3
@@ -5151,6 +5151,9 @@ static void prep_parse_options(struct diff_options *options)
5151 N_("generate diff using the \"patience diff\" algorithm"),
5152 PARSE_OPT_NONEG | PARSE_OPT_NOARG,
5153 diff_opt_patience),
5154 + OPT_BITOP(0, "histogram", &options->xdl_opts,
5155 + N_("generate diff using the \"histogram diff\" algorithm"),
5156 + XDF_HISTOGRAM_DIFF, XDF_DIFF_ALGORITHM_MASK),
5157
5158 OPT_GROUP(N_("Diff other options")),
5159 OPT_CALLBACK_F(0, "relative", options, N_("<prefix>"),
@@ -5189,9 +5192,7 @@ int diff_opt_parse(struct diff_options *options,
5192 return ac;
5193
5194 /* xdiff options */
5192 - if (!strcmp(arg, "--histogram"))
5193 - options->xdl_opts = DIFF_WITH_ALG(options, HISTOGRAM_DIFF);
5194 - else if ((argcount = parse_long_opt("diff-algorithm", av, &optarg))) {
5195 + if ((argcount = parse_long_opt("diff-algorithm", av, &optarg))) {
5196 long value = parse_algorithm_value(optarg);
5197 if (value < 0)
5198 return error("option diff-algorithm accepts \"myers\", "