summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 67dad68)
raw | patch | inline | side by side (parent: 67dad68)
author | Linus Torvalds <torvalds@linux-foundation.org> | |
Thu, 8 Feb 2007 17:51:56 +0000 (09:51 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 8 Feb 2007 23:35:24 +0000 (15:35 -0800) |
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>
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>
Documentation/git-reflog.txt | patch | blob | history | |
builtin-log.c | patch | blob | history | |
builtin-reflog.c | patch | blob | history | |
builtin.h | patch | blob | history |
index 11388658964b2c8acec5a2e9cd070fce6b177bd8..1e343bcdcdd4c1998b9887866507639bb31d030c 100644 (file)
SYNOPSIS
--------
-[verse]
-'git-reflog' expire [--dry-run] [--stale-fix]
- [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...
-
+'git reflog' <subcommand> <options>
DESCRIPTION
-----------
+The command takes various subcommands, and different options
+depending on the subcommand:
+
+[verse]
+git reflog expire [--dry-run] [--stale-fix]
+ [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...
+
+git reflog [show] [log-options]
Reflog is a mechanism to record when the tip of branches are
updated. This command is to manage the information recorded in it.
tip, are removed from the reflog. This is typically not used
directly by the end users -- instead, see gitlink:git-gc[1].
+The subcommand "show" (which is also the default, in the absense of any
+subcommands) will take all the normal log options, and show the log of
+the current branch. It is basically an alias for 'git log -g --abbrev-commit
+--pretty=oneline', see gitlink:git-log[1].
OPTIONS
diff --git a/builtin-log.c b/builtin-log.c
index 982d871887a6cd5f3e751a8c650ef95e8332b186..af2de54371cf7fc294c17431622f759e8e6066db 100644 (file)
--- a/builtin-log.c
+++ b/builtin-log.c
#include "log-tree.h"
#include "builtin.h"
#include "tag.h"
+#include "reflog-walk.h"
static int default_show_root = 1;
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;
diff --git a/builtin-reflog.c b/builtin-reflog.c
index bfb169ac04a3bddbe7afe79efc25e5ef3de59319..65b845b447b745eecd2a45e47a5c2226588dcfd1 100644 (file)
--- a/builtin-reflog.c
+++ b/builtin-reflog.c
*/
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;
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);
}
diff --git a/builtin.h b/builtin.h
index dd0e3529beba827fe564161aedeb84d78ae32f82..5108fd2d74588047316b450c88f9a3f565074c30 100644 (file)
--- a/builtin.h
+++ b/builtin.h
extern int cmd_help(int argc, const char **argv, const char *prefix);
extern int cmd_init_db(int argc, const char **argv, const char *prefix);
extern int cmd_log(int argc, const char **argv, const char *prefix);
+extern int cmd_log_reflog(int argc, const char **argv, const char *prefix);
extern int cmd_ls_files(int argc, const char **argv, const char *prefix);
extern int cmd_ls_tree(int argc, const char **argv, const char *prefix);
extern int cmd_mailinfo(int argc, const char **argv, const char *prefix);