summaryrefslogtreecommitdiff
path: root/builtin-checkout.c
diff options
context:
space:
mode:
authorThomas Rast <trast@student.ethz.ch>2009-01-17 17:09:56 +0100
committerJunio C Hamano <gitster@pobox.com>2009-01-17 18:37:21 -0800
commit696acf45f9638b014c7132508de26d1a571c8a33 (patch)
treeceeb225371a2f12017cdfe4dce350b626d34a6b0 /builtin-checkout.c
parentd18ba22154574390dbff2c060f44b9715477e95a (diff)
downloadgit-696acf45f9638b014c7132508de26d1a571c8a33.tar.gz
checkout: implement "-" abbreviation, add docs and tests
Have '-' mean the same as '@{-1}', i.e., the last branch we were on. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-checkout.c')
-rw-r--r--builtin-checkout.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin-checkout.c b/builtin-checkout.c
index dc1de06279..b0a101bac7 100644
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
@@ -679,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);