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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]