diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2010-08-26 00:47:58 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-08-26 09:05:02 -0700 |
commit | 635a7bb1d807390bedfc1147d2052e8423bcd1e0 (patch) | |
tree | 317b28d6a3d042cb3a5e728f62751e905b076535 /merge-recursive.c | |
parent | 7610fa57e63b0acc0a66717fc2d85755634db591 (diff) | |
download | git-635a7bb1d807390bedfc1147d2052e8423bcd1e0.tar.gz |
merge-recursive: expose merge options for builtin merge
There are two very similar blocks of code that recognize options for
the "recursive" merge strategy. Unify them.
No functional change intended.
Cc: Avery Pennarun <apenwarr@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r-- | merge-recursive.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/merge-recursive.c b/merge-recursive.c index 762b5494d2..44576b7927 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -1499,3 +1499,24 @@ void init_merge_options(struct merge_options *o) memset(&o->current_directory_set, 0, sizeof(struct string_list)); o->current_directory_set.strdup_strings = 1; } + +int parse_merge_opt(struct merge_options *o, const char *s) +{ + if (!s || !*s) + return -1; + if (!strcmp(s, "ours")) + o->recursive_variant = MERGE_RECURSIVE_OURS; + else if (!strcmp(s, "theirs")) + o->recursive_variant = MERGE_RECURSIVE_THEIRS; + else if (!strcmp(s, "subtree")) + o->subtree_shift = ""; + else if (!prefixcmp(s, "subtree=")) + o->subtree_shift = s + strlen("subtree="); + else if (!strcmp(s, "renormalize")) + o->renormalize = 1; + else if (!strcmp(s, "no-renormalize")) + o->renormalize = 0; + else + return -1; + return 0; +} |