summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8c5b85c)
raw | patch | inline | side by side (parent: 8c5b85c)
author | Linus Torvalds <torvalds@linux-foundation.org> | |
Fri, 20 Feb 2009 22:15:22 +0000 (14:15 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 21 Feb 2009 05:45:42 +0000 (21:45 -0800) |
Talking about --date, one thing I wanted for the 1234567890 date was to
get things in the raw format. Sure, you get them with --pretty=raw, but it
felt a bit sad that you couldn't just ask for the date in raw format.
So here's a throw-away patch (meaning: I won't be re-sending it, because I
really don't think it's a big deal) to add "--date=raw". It just prints
out the internal raw git format - seconds since epoch plus timezone (put
another way: 'date +"%s %z"' format)
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
get things in the raw format. Sure, you get them with --pretty=raw, but it
felt a bit sad that you couldn't just ask for the date in raw format.
So here's a throw-away patch (meaning: I won't be re-sending it, because I
really don't think it's a big deal) to add "--date=raw". It just prints
out the internal raw git format - seconds since epoch plus timezone (put
another way: 'date +"%s %z"' format)
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/rev-list-options.txt | patch | blob | history | |
cache.h | patch | blob | history | |
date.c | patch | blob | history |
index b9f6e4d1b7564480fac9c4e355fdc4936f6fa3db..507632287795ed7e63a1311b9cd783e71572ba3e 100644 (file)
Synonym for `--date=relative`.
---date={relative,local,default,iso,rfc,short}::
+--date={relative,local,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
+
`--date=short` shows only date but not time, in `YYYY-MM-DD` format.
+
+`--date=raw` shows the date in the internal raw git format `%s %z` format.
++
`--date=default` shows timestamps in the original timezone
(either committer's or author's).
index 21a63103d5d98e8dca520e923f73586f8544d3b4..189151de25ffd1a6671b7a70f359fa9b94b82173 100644 (file)
--- a/cache.h
+++ b/cache.h
DATE_SHORT,
DATE_LOCAL,
DATE_ISO8601,
- DATE_RFC2822
+ DATE_RFC2822,
+ DATE_RAW
};
const char *show_date(unsigned long time, int timezone, enum date_mode mode);
index 950b88fdcf74f550a582684f1702ffb58c62c7f9..d75dff42405404ec86820a534620c1ba68cd9116 100644 (file)
--- a/date.c
+++ b/date.c
struct tm *tm;
static char timebuf[200];
+ if (mode == DATE_RAW) {
+ snprintf(timebuf, sizeof(timebuf), "%lu %+05d", time, tz);
+ return timebuf;
+ }
+
if (mode == DATE_RELATIVE) {
unsigned long diff;
struct timeval now;
return DATE_LOCAL;
else if (!strcmp(format, "default"))
return DATE_NORMAL;
+ else if (!strcmp(format, "raw"))
+ return DATE_RAW;
else
die("unknown date format %s", format);
}