From: Thomas Rast <trast@student.ethz.ch>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
Johannes Schindelin <johannes.schindelin@gmx.de>,
"Shawn O. Pearce" <spearce@spearce.org>
Subject: [PATCH 1/3] log: Show reflog date with --date=normal
Date: Tue, 28 Jul 2009 10:40:20 +0200 [thread overview]
Message-ID: <1e2f7d731286d99b74cc9af37beb5fe187e9d460.1248770042.git.trast@student.ethz.ch> (raw)
The reflog case special-cases --date=default (internally DATE_NORMAL)
to show the entry number instead of a date. This means it is
impossible to show the default date format for the reflog entries.
Introduce a new state DATE_DEFAULT (for the existing --date=default)
that takes over the special value 0, and have DATE_NORMAL (for the new
--date=normal) act the same except in the reflog code where we still
special-case the value 0. This means that 'git log -g --date=normal'
shows the date, whereas 'git log -g --date=default' shows the reflog
entry number.
Thanks to Johannes Schindelin for IRC help.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
Documentation/git-rev-list.txt | 2 +-
Documentation/rev-list-options.txt | 7 +++++--
builtin-blame.c | 1 +
cache.h | 3 ++-
date.c | 2 ++
5 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt
index a765cfa..6f2013b 100644
--- a/Documentation/git-rev-list.txt
+++ b/Documentation/git-rev-list.txt
@@ -36,7 +36,7 @@ SYNOPSIS
[ \--regexp-ignore-case | -i ]
[ \--extended-regexp | -E ]
[ \--fixed-strings | -F ]
- [ \--date={local|relative|default|iso|rfc|short} ]
+ [ \--date={local|relative|normal|default|iso|rfc|short} ]
[ [\--objects | \--objects-edge] [ \--unpacked ] ]
[ \--pretty | \--header ]
[ \--bisect ]
diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index bf66116..2a106bd 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -13,7 +13,7 @@ include::pretty-options.txt[]
Synonym for `--date=relative`.
---date={relative,local,default,iso,rfc,short,raw}::
+--date={relative,local,normal,default,iso,rfc,short,raw}::
Only takes effect for dates shown in human-readable format, such
as when using "--pretty". `log.date` config variable sets a default
@@ -33,8 +33,11 @@ format, often found in E-mail messages.
+
`--date=raw` shows the date in the internal raw git format `%s %z` format.
+
-`--date=default` shows timestamps in the original timezone
+`--date=normal` shows timestamps in the original timezone
(either committer's or author's).
++
+`--date=default` is like `normal`, except for reflog entries where the
+entry number is shown instead.
ifdef::git-rev-list[]
--header::
diff --git a/builtin-blame.c b/builtin-blame.c
index fd6ca51..9671c20 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -2288,6 +2288,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
/* "normal" is used as the fallback for "relative" */
case DATE_LOCAL:
case DATE_NORMAL:
+ case DATE_DEFAULT:
blame_date_width = sizeof("Thu Oct 19 16:00:04 2006 -0700");
break;
}
diff --git a/cache.h b/cache.h
index e6c7f33..a62ce78 100644
--- a/cache.h
+++ b/cache.h
@@ -712,7 +712,8 @@ static inline unsigned int hexval(unsigned char c)
struct object *o, enum object_type);
enum date_mode {
- DATE_NORMAL = 0,
+ DATE_DEFAULT = 0,
+ DATE_NORMAL,
DATE_RELATIVE,
DATE_SHORT,
DATE_LOCAL,
diff --git a/date.c b/date.c
index 409a17d..661dd24 100644
--- a/date.c
+++ b/date.c
@@ -637,6 +637,8 @@ enum date_mode parse_date_format(const char *format)
else if (!strcmp(format, "local"))
return DATE_LOCAL;
else if (!strcmp(format, "default"))
+ return DATE_DEFAULT;
+ else if (!strcmp(format, "normal"))
return DATE_NORMAL;
else if (!strcmp(format, "raw"))
return DATE_RAW;
--
1.6.4.rc3.218.gb7ac
next reply other threads:[~2009-07-28 8:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-28 8:40 Thomas Rast [this message]
2009-07-28 8:40 ` [PATCH 2/3] log: --date and --no-date to toggle reflog dates Thomas Rast
2009-07-28 8:40 ` [PATCH 3/3] bash completion: log --date, --no-date and --date=normal Thomas Rast
2009-07-28 10:49 ` [PATCH 1/3] log: Show reflog date with --date=normal Johannes Schindelin
2009-07-28 10:51 ` Johannes Schindelin
2009-07-28 11:53 ` Thomas Rast
2009-07-28 12:31 ` Johannes Schindelin
2009-07-28 13:11 ` Thomas Rast
2009-07-28 13:27 ` Johannes Schindelin
2009-07-28 17:05 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1e2f7d731286d99b74cc9af37beb5fe187e9d460.1248770042.git.trast@student.ethz.ch \
--to=trast@student.ethz.ch \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johannes.schindelin@gmx.de \
--cc=spearce@spearce.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).