summaryrefslogtreecommitdiff
path: root/builtin-reflog.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2007-02-08 09:51:56 -0800
committerJunio C Hamano <junkio@cox.net>2007-02-08 15:35:24 -0800
commitcf39f54efc6ac45f9ef5319103a94d5afa75910e (patch)
tree942afce009184e3109d81eb509415f7309f224c9 /builtin-reflog.c
parent67dad687ad15d26d8e26f4d27874af0bc0965ce2 (diff)
downloadgit-cf39f54efc6ac45f9ef5319103a94d5afa75910e.tar.gz
git reflog show
It makes "git reflog [show]" act as git log -g --pretty=oneline --abbrev-cmit and is fairly straightforward. So you can just write git reflog or git reflog show and it will show you the reflog in a nice format. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-reflog.c')
-rw-r--r--builtin-reflog.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/builtin-reflog.c b/builtin-reflog.c
index bfb169ac04..65b845b447 100644
--- a/builtin-reflog.c
+++ b/builtin-reflog.c
@@ -13,7 +13,7 @@
*/
static const char reflog_expire_usage[] =
-"git-reflog expire [--verbose] [--dry-run] [--stale-fix] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";
+"git-reflog (show|expire) [--verbose] [--dry-run] [--stale-fix] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";
static unsigned long default_reflog_expire;
static unsigned long default_reflog_expire_unreachable;
@@ -372,10 +372,16 @@ static const char reflog_usage[] =
int cmd_reflog(int argc, const char **argv, const char *prefix)
{
- if (argc < 2)
- usage(reflog_usage);
- else if (!strcmp(argv[1], "expire"))
+ /* With no command, we default to showing it. */
+ if (argc < 2 || *argv[1] == '-')
+ return cmd_log_reflog(argc, argv, prefix);
+
+ if (!strcmp(argv[1], "show"))
+ return cmd_log_reflog(argc - 1, argv + 1, prefix);
+
+ if (!strcmp(argv[1], "expire"))
return cmd_reflog_expire(argc - 1, argv + 1, prefix);
- else
- usage(reflog_usage);
+
+ /* Not a recognized reflog command..*/
+ usage(reflog_usage);
}