[PATCH 67/86] builtin/merge: replace prefixcmd() with has_prefix()
STALE3764d
From: Christian Couder <hidden>
Date: 2016-06-15 22:59:12
Subsystem:
the rest · Maintainer:
Linus Torvalds
Signed-off-by: Christian Couder <redacted> --- builtin/merge.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/builtin/merge.c b/builtin/merge.c
index 02a69c1..5c70cec 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c@@ -453,17 +453,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 (has_prefix(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 (has_prefix(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 (has_prefix(found_ref, "refs/remotes/")) { strbuf_addf(msg, "%s\t\tremote-tracking branch '%s' of .\n", sha1_to_hex(branch_head), remote); goto cleanup;
@@ -577,8 +577,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 && has_prefix(k, "branch.") && + has_prefix(k + 7, branch) && !strcmp(k + 7 + strlen(branch), ".mergeoptions")) { free(branch_mergeoptions); branch_mergeoptions = xstrdup(v);
@@ -1113,7 +1113,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 && has_prefix(branch, "refs/heads/")) branch += 11; if (!branch || is_null_sha1(head_sha1)) head_commit = NULL;
--
1.8.4.1.566.geca833c