git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/3] log: --date and --no-date to toggle reflog dates

From
Thomas Rast <trast@student.ethz.ch>
Date
Jul 28, 2009, 08:40 UTC
Message-ID
<3fda7b9318674f9516f54f2c095148e79b6b3731.1248770042.git.trast@student.ethz.ch>
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
Previous: Thomas RastNext: Thomas Rast
Message 2 of 10 in “log: Show reflog date with --date=normal”
  1. 1/3 log: Show reflog date with --date=normalThomas Rast, Jul 28, 2009
  2. 2/3 log: --date and --no-date to toggle reflog datesThomas Rast, Jul 28, 2009
  3. 3/3 bash completion: log --date, --no-date and --date=normalThomas Rast, Jul 28, 2009
  4. Johannes SchindelinJul 28, 2009
  5. Johannes SchindelinJul 28, 2009
  6. Thomas RastJul 28, 2009
  7. Johannes SchindelinJul 28, 2009
  8. Thomas RastJul 28, 2009
  9. Johannes SchindelinJul 28, 2009
  10. Junio C HamanoJul 28, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.