Andrew's git
/
gitweb.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
commit
grep
author
committer
pickaxe
?
re
checkout: implement "-" abbreviation, add docs and tests
[gitweb.git]
/
builtin-checkout.c
diff --git
a/builtin-checkout.c
b/builtin-checkout.c
index dc1de06279e2fcdb945e3ec5bdcd0a6f7d06e51b..b0a101bac7432719d62c013d98bb0e6171e45406 100644
(file)
--- 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);