diff options
Diffstat (limited to 'builtin-merge-recursive.c')
-rw-r--r-- | builtin-merge-recursive.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/builtin-merge-recursive.c b/builtin-merge-recursive.c index 710674c6b2..1a160d8127 100644 --- a/builtin-merge-recursive.c +++ b/builtin-merge-recursive.c @@ -26,18 +26,29 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix) init_merge_options(&o); if (argv[0]) { - int namelen = strlen(argv[0]); - if (8 < namelen && - !strcmp(argv[0] + namelen - 8, "-subtree")) - o.subtree_merge = 1; + if (!suffixcmp(argv[0], "-subtree")) + o.recursive_variant = MERGE_RECURSIVE_SUBTREE; } if (argc < 4) usagef("%s <base>... -- <head> <remote> ...", argv[0]); for (i = 1; i < argc; ++i) { - if (!strcmp(argv[i], "--")) - break; + const char *arg = argv[i]; + + if (!prefixcmp(arg, "--")) { + if (!arg[2]) + break; + if (!strcmp(arg+2, "ours")) + o.recursive_variant = MERGE_RECURSIVE_OURS; + else if (!strcmp(arg+2, "theirs")) + o.recursive_variant = MERGE_RECURSIVE_THEIRS; + else if (!strcmp(arg+2, "subtree")) + o.recursive_variant = MERGE_RECURSIVE_SUBTREE; + else + die("Unknown option %s", arg); + continue; + } if (bases_count < ARRAY_SIZE(bases)-1) { unsigned char *sha = xmalloc(20); if (get_sha1(argv[i], sha)) |