Skip to content

Commit 1a2a1e8

Browse files
peffgitster
authored andcommitted
date: document and test "raw-local" mode
The "raw" format shows a Unix epoch timestamp, but with a timezone tacked on. The timestamp is not _in_ that zone, but it is extra information about the time (by default, the zone the author was in). The documentation claims that "raw-local" does not work. It does, but the end result is rather subtle. Let's describe it in better detail, and test to make sure it works (namely, the epoch time doesn't change, but the zone does). While we are rewording the documentation in this area, let's not use the phrase "does not work" for the remaining option, "--date=relative". It's vague; do we accept it or not? We do accept it, but it has no effect (which is a reasonable outcome). We should also refer to the option not as "--relative" (which is the historical synonym, and does not take "-local" at all), but as "--date=relative". Helped-by: Jakub Narębski <[email protected]> Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d38c7b2 commit 1a2a1e8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Documentation/rev-list-options.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,8 +725,8 @@ include::pretty-options.txt[]
725725
`iso-local`), the user's local time zone is used instead.
726726
+
727727
`--date=relative` shows dates relative to the current time,
728-
e.g. ``2 hours ago''. The `-local` option cannot be used with
729-
`--raw` or `--relative`.
728+
e.g. ``2 hours ago''. The `-local` option has no effect for
729+
`--date=relative`.
730730
+
731731
`--date=local` is an alias for `--date=default-local`.
732732
+
@@ -747,6 +747,9 @@ format, often found in email messages.
747747
`--date=short` shows only the date, but not the time, in `YYYY-MM-DD` format.
748748
+
749749
`--date=raw` shows the date in the internal raw Git format `%s %z` format.
750+
Note that the `-local` option does not affect the seconds-since-epoch
751+
value (which is always measured in UTC), but does switch the accompanying
752+
timezone value.
750753
+
751754
`--date=format:...` feeds the format `...` to your system `strftime`.
752755
Use `--date=format:%c` to show the date in your system locale's

t/t0006-date.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ check_show short "$TIME" '2016-06-15'
4747
check_show default "$TIME" 'Wed Jun 15 16:13:20 2016 +0200'
4848
check_show raw "$TIME" '1466000000 +0200'
4949
check_show iso-local "$TIME" '2016-06-15 14:13:20 +0000'
50+
check_show raw-local "$TIME" '1466000000 +0000'
5051

5152
# arbitrary time absurdly far in the future
5253
FUTURE="5758122296 -0400"

0 commit comments

Comments
 (0)