notes: extract parse_notes_merge_strategy to notes-utils
[gitweb.git] / builtin / notes.c
index 63f95fc55439060670879fd987033000b8ba3401..29816f9fbba284bca363b1e0c641399a313374a4 100644 (file)
@@ -796,17 +796,7 @@ static int merge(int argc, const char **argv, const char *prefix)
        o.remote_ref = remote_ref.buf;
 
        if (strategy) {
-               if (!strcmp(strategy, "manual"))
-                       o.strategy = NOTES_MERGE_RESOLVE_MANUAL;
-               else if (!strcmp(strategy, "ours"))
-                       o.strategy = NOTES_MERGE_RESOLVE_OURS;
-               else if (!strcmp(strategy, "theirs"))
-                       o.strategy = NOTES_MERGE_RESOLVE_THEIRS;
-               else if (!strcmp(strategy, "union"))
-                       o.strategy = NOTES_MERGE_RESOLVE_UNION;
-               else if (!strcmp(strategy, "cat_sort_uniq"))
-                       o.strategy = NOTES_MERGE_RESOLVE_CAT_SORT_UNIQ;
-               else {
+               if (parse_notes_merge_strategy(strategy, &o.strategy)) {
                        error("Unknown -s/--strategy: %s", strategy);
                        usage_with_options(git_notes_merge_usage, options);
                }