use skip_prefix() to avoid more magic numbers
[gitweb.git] / builtin / checkout.c
index 8afdf2b5c4bfbd53e7315afe9d8ae3d88f93dd57..cef1996d1663fb2f5d4b910bfd1661ebe2fe042b 100644 (file)
@@ -1150,10 +1150,8 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
                const char *argv0 = argv[0];
                if (!argc || !strcmp(argv0, "--"))
                        die (_("--track needs a branch name"));
-               if (starts_with(argv0, "refs/"))
-                       argv0 += 5;
-               if (starts_with(argv0, "remotes/"))
-                       argv0 += 8;
+               skip_prefix(argv0, "refs/", &argv0);
+               skip_prefix(argv0, "remotes/", &argv0);
                argv0 = strchr(argv0, '/');
                if (!argv0 || !argv0[1])
                        die (_("Missing branch name; try -b"));