summaryrefslogtreecommitdiff
path: root/builtin-log.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-log.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-log.c')
-rw-r--r--builtin-log.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/builtin-log.c b/builtin-log.c
index 982d871887..af2de54371 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -11,6 +11,7 @@
#include "log-tree.h"
#include "builtin.h"
#include "tag.h"
+#include "reflog-walk.h"
static int default_show_root = 1;
@@ -181,6 +182,37 @@ int cmd_show(int argc, const char **argv, const char *prefix)
return ret;
}
+/*
+ * This is equivalent to "git log -g --abbrev-commit --pretty=oneline"
+ */
+int cmd_log_reflog(int argc, const char **argv, const char *prefix)
+{
+ struct rev_info rev;
+
+ git_config(git_log_config);
+ init_revisions(&rev, prefix);
+ init_reflog_walk(&rev.reflog_info);
+ rev.abbrev_commit = 1;
+ rev.verbose_header = 1;
+ cmd_log_init(argc, argv, prefix, &rev);
+
+ /*
+ * This means that we override whatever commit format the user gave
+ * on the cmd line. Sad, but cmd_log_init() currently doesn't
+ * allow us to set a different default.
+ */
+ rev.commit_format = CMIT_FMT_ONELINE;
+ rev.always_show_header = 1;
+
+ /*
+ * We get called through "git reflog", so unlike the other log
+ * routines, we need to set up our pager manually..
+ */
+ setup_pager();
+
+ return cmd_log_walk(&rev);
+}
+
int cmd_log(int argc, const char **argv, const char *prefix)
{
struct rev_info rev;