cmd_fetch_pack(): return early if finish_connect() fails
[gitweb.git] / builtin / merge-recursive.c
index d8875d589240e0c78a9e241a7d2bdde1d10ab800..3a64f5d0bdbcc8d7d21edb01f285cc8b41755228 100644 (file)
@@ -1,7 +1,11 @@
-#include "cache.h"
+#include "builtin.h"
 #include "commit.h"
 #include "tag.h"
 #include "merge-recursive.h"
+#include "xdiff-interface.h"
+
+static const char builtin_merge_recursive_usage[] =
+       "git %s <base>... -- <head> <remote> ...";
 
 static const char *better_branch_name(const char *branch)
 {
@@ -29,7 +33,7 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix)
                o.subtree_shift = "";
 
        if (argc < 4)
-               usagef("%s <base>... -- <head> <remote> ...", argv[0]);
+               usagef(builtin_merge_recursive_usage, argv[0]);
 
        for (i = 1; i < argc; ++i) {
                const char *arg = argv[i];
@@ -37,15 +41,7 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix)
                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.subtree_shift = "";
-                       else if (!prefixcmp(arg+2, "subtree="))
-                               o.subtree_shift = arg + 10;
-                       else
+                       if (parse_merge_opt(&o, arg + 2))
                                die("Unknown option %s", arg);
                        continue;
                }