t1505: remove debugging cruft
[gitweb.git] / builtin-checkout.c
index a3b69d6b94dce47b3341f5eb77ae4438bae20cc6..b0a101bac7432719d62c013d98bb0e6171e45406 100644 (file)
@@ -361,8 +361,10 @@ struct branch_info {
 static void setup_branch_path(struct branch_info *branch)
 {
        struct strbuf buf = STRBUF_INIT;
+       int ret;
 
-       if (!interpret_nth_last_branch(branch->name, &buf)) {
+       if ((ret = interpret_nth_last_branch(branch->name, &buf))
+           && ret == strlen(branch->name)) {
                branch->name = xstrdup(buf.buf);
                strbuf_splice(&buf, 0, 0, "refs/heads/", 11);
        } else {
@@ -677,6 +679,9 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
                arg = argv[0];
                has_dash_dash = (argc > 1) && !strcmp(argv[1], "--");
 
+               if (!strcmp(arg, "-"))
+                       arg = "@{-1}";
+
                if (get_sha1(arg, rev)) {
                        if (has_dash_dash)          /* case (1) */
                                die("invalid reference: %s", arg);