git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 2/3] log: --date and --no-date to toggle reflog dates
Date: Tue, 28 Jul 2009 10:40:21 +0200	[thread overview]
Message-ID: <3fda7b9318674f9516f54f2c095148e79b6b3731.1248770042.git.trast@student.ethz.ch> (raw)
In-Reply-To: <1e2f7d731286d99b74cc9af37beb5fe187e9d460.1248770042.git.trast@student.ethz.ch>

Introduce two new options that help the user, especially in the case
where log.date is set to some value other than "normal":

--date: equivalent to --date=normal if it was previously "default"
--no-date: equivalent to --date=default

This means that 'git reflog --date' will always show reflog entries by
date, and 'git reflog --no-date' won't even if log.date is set.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
 Documentation/git-rev-list.txt     |    2 +-
 Documentation/rev-list-options.txt |   11 ++++++++++-
 revision.c                         |    5 +++++
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt
index 6f2013b..023a595 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|normal|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 2a106bd..e83e8bd 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,normal,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
@@ -38,6 +38,15 @@ format, often found in E-mail messages.
 +
 `--date=default` is like `normal`, except for reflog entries where the
 entry number is shown instead.
++
+`--date` sets the date display to `normal` if it was previously
+`default`, so it serves as a shorthand to display reflog entries with
+date instead of number.
+
+--no-date::
+
+	Synonym for `--date=default`, so named because it causes
+	reflog entries to be shown by number instead of date.
 
 ifdef::git-rev-list[]
 --header::
diff --git a/revision.c b/revision.c
index 9f5dac5..941f631 100644
--- a/revision.c
+++ b/revision.c
@@ -1159,6 +1159,11 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
 		revs->simplify_history = 0;
 	} else if (!strcmp(arg, "--relative-date")) {
 		revs->date_mode = DATE_RELATIVE;
+	} else if (!strcmp(arg, "--date")) {
+		if (!revs->date_mode)
+			revs->date_mode = DATE_NORMAL;
+	} else if (!strcmp(arg, "--no-date")) {
+		revs->date_mode = DATE_DEFAULT;
 	} else if (!strncmp(arg, "--date=", 7)) {
 		revs->date_mode = parse_date_format(arg + 7);
 	} else if (!strcmp(arg, "--log-size")) {
-- 
1.6.4.rc3.218.gb7ac

  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 [PATCH 1/3] log: Show reflog date with --date=normal Thomas Rast
2009-07-28  8:40 ` Thomas Rast [this message]
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=3fda7b9318674f9516f54f2c095148e79b6b3731.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).