checkout,clone: check return value of create_symref
[gitweb.git] / builtin / merge-recursive.c
index 3a64f5d0bdbcc8d7d21edb01f285cc8b41755228..491efd556e87d0b263bb1029e0cabb9b7f6f1472 100644 (file)
@@ -14,7 +14,7 @@ static const char *better_branch_name(const char *branch)
 
        if (strlen(branch) != 40)
                return branch;
-       sprintf(githead_env, "GITHEAD_%s", branch);
+       xsnprintf(githead_env, sizeof(githead_env), "GITHEAD_%s", branch);
        name = getenv(githead_env);
        return name ? name : branch;
 }
@@ -29,7 +29,7 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix)
        struct commit *result;
 
        init_merge_options(&o);
-       if (argv[0] && !suffixcmp(argv[0], "-subtree"))
+       if (argv[0] && ends_with(argv[0], "-subtree"))
                o.subtree_shift = "";
 
        if (argc < 4)
@@ -38,7 +38,7 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix)
        for (i = 1; i < argc; ++i) {
                const char *arg = argv[i];
 
-               if (!prefixcmp(arg, "--")) {
+               if (starts_with(arg, "--")) {
                        if (!arg[2])
                                break;
                        if (parse_merge_opt(&o, arg + 2))