]> git.ipfire.org Git - thirdparty/git.git/blobdiff - help.c
use skip_prefix to avoid repeating strings
[thirdparty/git.git] / help.c
diff --git a/help.c b/help.c
index b0f1a697216ded21bf7e1f9147be4dc611bd94de..79e800714780568009f66787aa25079ec6b81fac 100644 (file)
--- a/help.c
+++ b/help.c
@@ -414,11 +414,12 @@ static int append_similar_ref(const char *refname, const unsigned char *sha1,
 {
        struct similar_ref_cb *cb = (struct similar_ref_cb *)(cb_data);
        char *branch = strrchr(refname, '/') + 1;
+       const char *remote;
+
        /* A remote branch of the same name is deemed similar */
-       if (starts_with(refname, "refs/remotes/") &&
+       if (skip_prefix(refname, "refs/remotes/", &remote) &&
            !strcmp(branch, cb->base_ref))
-               string_list_append(cb->similar_refs,
-                                  refname + strlen("refs/remotes/"));
+               string_list_append(cb->similar_refs, remote);
        return 0;
 }