diff: allow unstuck arguments with --diff-algorithm

The argument to --diff-algorithm is mandatory, so there is no reason to require the argument to be stuck to the option with '='. Change this for consistency with other Git commands. Note that this does not change the handling of diff-algorithm in merge-recursive.c since the primary interface to that is via the -X option to 'git merge' where the unstuck form does not make sense. Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>

John Keeping committed Apr 5, 2013 at 13:19 UTC 0895c6d4c09045a3faeb7b652a844fc81c774631
1 file changed +3 -2
diff.c
+3 -2
@@ -3634,8 +3634,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
3634 options->xdl_opts = DIFF_WITH_ALG(options, PATIENCE_DIFF);
3635 else if (!strcmp(arg, "--histogram"))
3636 options->xdl_opts = DIFF_WITH_ALG(options, HISTOGRAM_DIFF);
3637 - else if (!prefixcmp(arg, "--diff-algorithm=")) {
3638 - long value = parse_algorithm_value(arg+17);
3637 + else if ((argcount = parse_long_opt("diff-algorithm", av, &optarg))) {
3638 + long value = parse_algorithm_value(optarg);
3639 if (value < 0)
3640 return error("option diff-algorithm accepts \"myers\", "
3641 "\"minimal\", \"patience\" and \"histogram\"");
@@ -3643,6 +3643,7 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
3643 DIFF_XDL_CLR(options, NEED_MINIMAL);
3644 options->xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK;
3645 options->xdl_opts |= value;
3646 + return argcount;
3647 }
3648
3649 /* flags options */