aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorMichael J Gruber <git@drmicha.warpmail.net>2011-04-01 11:20:31 +0200
committerJunio C Hamano <gitster@pobox.com>2011-04-01 14:42:25 -0700
commitef803fd4b09bca707c7c27669a2789bb050b488c (patch)
treecad535fbfa0afd570bbbc75efac196bcc5e3afb7 /builtin
parent2352570bf43368f3d3931f7b24bb7fd44e68eef3 (diff)
downloadgit-ef803fd4b09bca707c7c27669a2789bb050b488c.tar.gz
git-ef803fd4b09bca707c7c27669a2789bb050b488c.tar.xz
builtin/log.c: separate default and setup of cmd_log_init()
cmd_log_init() sets up some default rev options and then calls setup_revisions(), so that a caller cannot set up own defaults: Either they get overriden by cmd_log_init() (if set before) or they override the command line (if set after). We even complain about this in a comment to cmd_log_reflog(). Therefore, separate the two steps so that one can still call cmd_log_init() or, alternatively, cmd_log_init_defaults() followed by cmd_log_init_finish() (and set defaults in between). No functional change so far. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/log.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/builtin/log.c b/builtin/log.c
index 0f43d2ec7..59fe58855 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -49,13 +49,8 @@ static int parse_decoration_style(const char *var, const char *value)
return -1;
}
-static void cmd_log_init(int argc, const char **argv, const char *prefix,
- struct rev_info *rev, struct setup_revision_opt *opt)
+static void cmd_log_init_defaults(struct rev_info *rev)
{
- int i;
- int decoration_given = 0;
- struct userformat_want w;
-
rev->abbrev = DEFAULT_ABBREV;
rev->commit_format = CMIT_FMT_DEFAULT;
if (fmt_pretty)
@@ -68,7 +63,14 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
if (default_date_mode)
rev->date_mode = parse_date_format(default_date_mode);
+}
+static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
+ struct rev_info *rev, struct setup_revision_opt *opt)
+{
+ int i;
+ int decoration_given = 0;
+ struct userformat_want w;
/*
* Check for -h before setup_revisions(), or "git log -h" will
* fail when run without a git directory.
@@ -128,6 +130,13 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
setup_pager();
}
+static void cmd_log_init(int argc, const char **argv, const char *prefix,
+ struct rev_info *rev, struct setup_revision_opt *opt)
+{
+ cmd_log_init_defaults(rev);
+ cmd_log_init_finish(argc, argv, prefix, rev, opt);
+}
+
/*
* This gives a rough estimate for how many commits we
* will print out in the list.