]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/merge.c
replace {pre,suf}fixcmp() with {starts,ends}_with()
[thirdparty/git.git] / builtin / merge.c
index 41fb66dec2c2fd9645a72c28c362067fb3bcc16c..4941a6c36ab215fdb709ac58a3aea69218025dbb 100644 (file)
@@ -446,17 +446,17 @@ static void merge_name(const char *remote, struct strbuf *msg)
                die(_("'%s' does not point to a commit"), remote);
 
        if (dwim_ref(remote, strlen(remote), branch_head, &found_ref) > 0) {
-               if (!prefixcmp(found_ref, "refs/heads/")) {
+               if (starts_with(found_ref, "refs/heads/")) {
                        strbuf_addf(msg, "%s\t\tbranch '%s' of .\n",
                                    sha1_to_hex(branch_head), remote);
                        goto cleanup;
                }
-               if (!prefixcmp(found_ref, "refs/tags/")) {
+               if (starts_with(found_ref, "refs/tags/")) {
                        strbuf_addf(msg, "%s\t\ttag '%s' of .\n",
                                    sha1_to_hex(branch_head), remote);
                        goto cleanup;
                }
-               if (!prefixcmp(found_ref, "refs/remotes/")) {
+               if (starts_with(found_ref, "refs/remotes/")) {
                        strbuf_addf(msg, "%s\t\tremote-tracking branch '%s' of .\n",
                                    sha1_to_hex(branch_head), remote);
                        goto cleanup;
@@ -570,8 +570,8 @@ static int git_merge_config(const char *k, const char *v, void *cb)
 {
        int status;
 
-       if (branch && !prefixcmp(k, "branch.") &&
-               !prefixcmp(k + 7, branch) &&
+       if (branch && starts_with(k, "branch.") &&
+               starts_with(k + 7, branch) &&
                !strcmp(k + 7 + strlen(branch), ".mergeoptions")) {
                free(branch_mergeoptions);
                branch_mergeoptions = xstrdup(v);
@@ -1106,7 +1106,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
         * current branch.
         */
        branch = branch_to_free = resolve_refdup("HEAD", head_sha1, 0, &flag);
-       if (branch && !prefixcmp(branch, "refs/heads/"))
+       if (branch && starts_with(branch, "refs/heads/"))
                branch += 11;
        if (!branch || is_null_sha1(head_sha1))
                head_commit = NULL;