summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 950ce2e)
raw | patch | inline | side by side (parent: 950ce2e)
author | Heikki Orsila <heikki.orsila@iki.fi> | |
Thu, 22 May 2008 15:24:07 +0000 (18:24 +0300) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 23 May 2008 23:05:42 +0000 (16:05 -0700) |
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>
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>
Documentation/config.txt | patch | blob | history | |
Documentation/rev-list-options.txt | patch | blob | history | |
builtin-log.c | patch | blob | history |
index 554977b89519fb11a6a02d100bf65c3531e86f6f..002a06689343df9201d8c08beff8147c8a55e8b7 100644 (file)
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
The port number to bind the gitweb httpd to. See
linkgit:git-instaweb[1].
+log.date::
+ Set default date-time mode for the log command. Setting log.date
+ value is similar to using git log's --date option. The value is one of
+ following alternatives: {relative,local,default,iso,rfc,short}.
+ See linkgit:git-log[1].
+
log.showroot::
If true, the initial commit will be shown as a big creation event.
This is equivalent to a diff against an empty tree.
index ce6a1017a34aed25efc192e889a9f04adb5aa2f3..3558348b720aa62d6a34719daed5fb623a10501d 100644 (file)
--date={relative,local,default,iso,rfc}::
Only takes effect for dates shown in human-readable format, such
- as when using "--pretty".
+ as when using "--pretty". `log.date` config variable sets a default
+ value for log command's --date option.
+
`--date=relative` shows dates relative to the current time,
e.g. "2 hours ago".
diff --git a/builtin-log.c b/builtin-log.c
index 9d046b2e035bfa6ae63d6d004e5a92072a202d70..543855b7ad11bd0355d88bc1502030509875e0c7 100644 (file)
--- a/builtin-log.c
+++ b/builtin-log.c
#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;
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)) {
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;