Merge branch 'jk/skip-prefix'
[gitweb.git] / builtin / checkout.c
index f1dc56e55f7b2200412142b10517458ccfda2952..463cfeea5067fe02d8eb1414018c97ff9a757176 100644 (file)
@@ -776,8 +776,8 @@ static int switch_branches(const struct checkout_opts *opts,
        if (!(flag & REF_ISSYMREF))
                old.path = NULL;
 
-       if (old.path && starts_with(old.path, "refs/heads/"))
-               old.name = old.path + strlen("refs/heads/");
+       if (old.path)
+               skip_prefix(old.path, "refs/heads/", &old.name);
 
        if (!new->name) {
                new->name = "HEAD";