From 07924d4d50e5304fb53eb60aaba8aef31d4c4e5e Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Wed, 16 Jan 2013 08:51:58 +0100 Subject: diff: Introduce --diff-algorithm command line option Since command line options have higher priority than config file variables and taking previous commit into account, we need a way how to specify myers algorithm on command line. However, inventing `--myers` is not the right answer. We need far more general option, and that is `--diff-algorithm`. Signed-off-by: Michal Privoznik Signed-off-by: Junio C Hamano --- merge-recursive.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'merge-recursive.c') diff --git a/merge-recursive.c b/merge-recursive.c index 33ba5dc07c..ea9dbd307c 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -2068,6 +2068,15 @@ int parse_merge_opt(struct merge_options *o, const char *s) o->xdl_opts = DIFF_WITH_ALG(o, PATIENCE_DIFF); else if (!strcmp(s, "histogram")) o->xdl_opts = DIFF_WITH_ALG(o, HISTOGRAM_DIFF); + else if (!strcmp(s, "diff-algorithm=")) { + long value = parse_algorithm_value(s+15); + if (value < 0) + return -1; + /* clear out previous settings */ + DIFF_XDL_CLR(o, NEED_MINIMAL); + o->xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK; + o->xdl_opts |= value; + } else if (!strcmp(s, "ignore-space-change")) o->xdl_opts |= XDF_IGNORE_WHITESPACE_CHANGE; else if (!strcmp(s, "ignore-all-space")) -- cgit v1.2.1