summaryrefslogtreecommitdiff
path: root/builtin-log.c
diff options
context:
space:
mode:
authorHeikki Orsila <heikki.orsila@iki.fi>2008-05-22 18:24:07 +0300
committerJunio C Hamano <gitster@pobox.com>2008-05-23 16:05:42 -0700
commitdd0ffd5b31a672db90d8b775988d55829e6f5f9f (patch)
tree2bfdde89effdd974e261343887bce6d1c4449e6d /builtin-log.c
parent950ce2e22db4a3c1ff9ad598b46ccb22c517a336 (diff)
downloadgit-dd0ffd5b31a672db90d8b775988d55829e6f5f9f.tar.gz
Add log.date config variable
log.date config variable sets the default date-time mode for the log command. Setting log.date value is similar to using git log's --date option. Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-log.c')
-rw-r--r--builtin-log.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/builtin-log.c b/builtin-log.c
index 9d046b2e03..543855b7ad 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -18,6 +18,9 @@
#include "run-command.h"
#include "shortlog.h"
+/* Set a default date-time format for git log ("log.date" config variable) */
+static const char *default_date_mode = NULL;
+
static int default_show_root = 1;
static const char *fmt_patch_subject_prefix = "PATCH";
static const char *fmt_pretty;
@@ -61,7 +64,12 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
DIFF_OPT_SET(&rev->diffopt, RECURSIVE);
rev->show_root_diff = default_show_root;
rev->subject_prefix = fmt_patch_subject_prefix;
+
+ if (default_date_mode)
+ rev->date_mode = parse_date_format(default_date_mode);
+
argc = setup_revisions(argc, argv, rev, "HEAD");
+
if (rev->diffopt.pickaxe || rev->diffopt.filter)
rev->always_show_header = 0;
if (DIFF_OPT_TST(&rev->diffopt, FOLLOW_RENAMES)) {
@@ -232,6 +240,8 @@ static int git_log_config(const char *var, const char *value)
fmt_patch_subject_prefix = xstrdup(value);
return 0;
}
+ if (!strcmp(var, "log.date"))
+ return git_config_string(&default_date_mode, var, value);
if (!strcmp(var, "log.showroot")) {
default_show_root = git_config_bool(var, value);
return 0;