Support output ISO 8601 format dates
PATCH 1/1 Support output ISO 8601 format dates
Support output of full ISO 8601 style dates in e.g. git log and other places that use interpolation for formatting.
---
cache.h | 2 +- commit.c | 6 +++++- date.c | 7 +++++++ 3 files changed, 13 insertions(+), 2 deletions(-)
cache.h +1 -1
@@ -389,7 +389,7 @@ extern void *read_object_with_reference(const unsigned char *sha1,unsigned long *size, unsigned char *sha1_ret); -enum date_mode {DATE_NORMAL =0 ,DATE_RELATIVE ,DATE_SHORT ,DATE_LOCAL }; +enum date_mode {DATE_NORMAL =0 ,DATE_RELATIVE ,DATE_SHORT ,DATE_LOCAL ,DATE_ISO8601 };const char *show_date (unsigned long time,int timezone,enum date_mode mode);const char *show_rfc2822_date (unsigned long time,int timezone);int parse_date (const char *date,char *buf,int bufsize);
commit.c +5 -1
@@ -773,6 +773,7 @@ static void fill_person(struct interp *table, const char *msg, int len)interp_set_entry (table,2 ,show_date (date, tz,0 ));interp_set_entry (table,3 ,show_rfc2822_date (date, tz));interp_set_entry (table,4 ,show_date (date, tz,1 )); +interp_set_entry (table,6 ,show_date (date, tz,DATE_ISO8601 )); } static long format_commit_message(const struct commit *commit,
@@ -791,12 +792,14 @@ static long format_commit_message(const struct commit *commit, { "%aD" }, /* author date, RFC2822 style */ { "%ar" }, /* author date, relative */ { "%at" }, /* author date, UNIX timestamp */ + { "%ai" }, /* author date, ISO 8601 */ { "%cn" }, /* committer name */ { "%ce" }, /* committer email */ { "%cd" }, /* committer date */ { "%cD" }, /* committer date, RFC2822 style */ { "%cr" }, /* committer date, relative */ { "%ct" }, /* committer date, UNIX timestamp */ + { "%ci" }, /* committer date, ISO 8601 */ { "%e" }, /* encoding */ { "%s" }, /* subject */ { "%b" }, /* body */
@@ -813,10 +816,11 @@ static long format_commit_message(const struct commit *commit,IPARENTS ,IPARENTS_ABBREV ,IAUTHOR_NAME ,IAUTHOR_EMAIL ,IAUTHOR_DATE ,IAUTHOR_DATE_RFC2822 ,IAUTHOR_DATE_RELATIVE , -IAUTHOR_TIMESTAMP , +IAUTHOR_TIMESTAMP ,IAUTHOR_ISO8601 ,ICOMMITTER_NAME ,ICOMMITTER_EMAIL ,ICOMMITTER_DATE ,ICOMMITTER_DATE_RFC2822 ,ICOMMITTER_DATE_RELATIVE ,ICOMMITTER_TIMESTAMP , +ICOMMITTER_ISO8601 ,IENCODING ,ISUBJECT , IBODY,
date.c +7 -0
@@ -137,6 +137,13 @@ const char *show_date(unsigned long time, int tz, enum date_mode mode)if (mode ==DATE_SHORT )sprintf (timebuf,"%04d-%02d-%02d" , tm->tm_year +1900 , tm->tm_mon +1 , tm->tm_mday); +else if (mode ==DATE_ISO8601 ) +sprintf (timebuf,"%04d-%02d-%02d %02d:%02d:%02d %+05d" , + tm->tm_year +1900 , + tm->tm_mon +1 , + tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec, + tz);else sprintf(timebuf, "%.3s %.3s %d %02d:%02d:%02d %d%c%+05d", weekday_names[tm->tm_wday],
Hello,
date.c const char *show_date(unsigned long time, int tz, enum date_mode mode) · line 146
Quoted 7 lines · Robin Rosenberg
date.c +7
-0+else if (mode ==DATE_ISO8601 ) +sprintf (timebuf,"%04d-%02d-%02d %02d:%02d:%02d %+05d" , + tm->tm_year +1900 , + tm->tm_mon +1 , + tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec, + tz);
I apologise for nitpicking, but ISO 8601 (and RFC 3339) says separator between date and time is 'T' and there is no separator between time and timezone. So this should be
+ sprintf(timebuf, "%04d-%02d-%02dT%02d:%02d:%02d%+05d",
for 100% conformance to the standard. RFC 3339 explicitely mentions using space instead of 'T' as separator as allowed, but does not seem to mention space before time zone. There may be applications that would stop at such space and assume no timezone information.
Furthermore RFC 3339 seems to require colon in the timezone, so it would be:
+ sprintf(timebuf, "%04d-%02d-%02dT%02d:%02d:%02d%+03d:%02d",
+ tm->tm_year + 1900,
+ tm->tm_mon + 1,
+ tm->tm_mday,
+ tm->tm_hour, tm->tm_min, tm->tm_sec,
+ tz / 100, abs(tz % 100));
ISO 8601 makes separators optional, so simple 4-digit timezone is OK.
Signature · 1 line
Jan 'Bulb' Hudec <[email protected]>
From 59eafc201aec3be121b33c2ecf16c70cc3521e92 Mon Sep 17 00:00:00 2001
From: Robin Rosenberg <[email protected]>
Date: Mon, 16 Jul 2007 01:05:19 +0200
Subject: [PATCH] Support output ISO 8601 format dates
Support output of full ISO 8601 style dates in e.g. git log and other places that use interpolation for formatting.
--- Documentation/pretty-formats.txt | 2 ++ cache.h | 2 +- commit.c | 6 +++++- date.c | 9 +++++++++ 4 files changed, 17 insertions(+), 2 deletions(-)
söndag 15 juli 2007 skrev Jan Hudec:
Quoted 15 lines
Hello,
Review
Quoted 7 lines · Robin Rosenberg
(quoted diff) +7
-0+ else if (mode == DATE_ISO8601) + sprintf(timebuf, "%04d-%02d-%02d %02d:%02d:%02d %+05d", + tm->tm_year + 1900, + tm->tm_mon + 1, + tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec, + tz);I apologise for nitpicking, but ISO 8601 (and RFC 3339) says separator between date and time is 'T' and there is no separator between time and timezone. So this should be
Review
Quoted 1 line
(quoted diff) +1
-0+ sprintf(timebuf, "%04d-%02d-%02dT%02d:%02d:%02d%+05d",
Note that my reference is to ISO 8601, not RFC 3339. Hower I interpret "NOTE By mutual agreement of the partners in information interchange, the character [T] may be omitted in applications where there is no risk of confusing a date and time of day representation with others defined in this International Standard" (ISO 8601:2004 4.3.2) as space being allowed here instead of 'T'.
By "mutual agreement" I mean that I tell you what it looks like and you agree :)
I agree with you about the space before timezone though. I'll go.
Quoted 14 lines
for 100% conformance to the standard. RFC 3339 explicitely mentions using space instead of 'T' as separator as allowed, but does not seem to mention space before time zone. There may be applications that would stop at such space and assume no timezone information.
Furthermore RFC 3339 seems to require colon in the timezone, so it would be:
(quoted diff) +6
-0+ sprintf(timebuf, "%04d-%02d-%02dT%02d:%02d:%02d%+03d:%02d", + tm->tm_year + 1900, + tm->tm_mon + 1, + tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec, + tz / 100, abs(tz % 100));
Quoted 1 line
ISO 8601 makes separators optional, so simple 4-digit timezone is OK.
For the sake of consequence I should use the extended format for all parts and not mix basic and extended formats.
Updated patch follows that formats dates as "2006-08-17 20:59:46+05:30"
-- robin
Documentation/pretty-formats.txt +2 -0
@@ -106,12 +106,14 @@ The placeholders are: - '%aD': author date, RFC2822 style - '%ar': author date, relative - '%at': author date, UNIX timestamp +- '%ai': author date, ISO 8601 format - '%cn': committer name - '%ce': committer email - '%cd': committer date - '%cD': committer date, RFC2822 style - '%cr': committer date, relative - '%ct': committer date, UNIX timestamp +- '%ci': committer date, ISO 8601 format - '%e': encoding - '%s': subject - '%b': body
cache.h +1 -1
@@ -389,7 +389,7 @@ extern void *read_object_with_reference(const unsigned char *sha1,unsigned long *size, unsigned char *sha1_ret); -enum date_mode {DATE_NORMAL =0 ,DATE_RELATIVE ,DATE_SHORT ,DATE_LOCAL }; +enum date_mode {DATE_NORMAL =0 ,DATE_RELATIVE ,DATE_SHORT ,DATE_LOCAL ,DATE_ISO8601 };const char *show_date (unsigned long time,int timezone,enum date_mode mode);const char *show_rfc2822_date (unsigned long time,int timezone);int parse_date (const char *date,char *buf,int bufsize);
commit.c +5 -1
@@ -773,6 +773,7 @@ static void fill_person(struct interp *table, const char *msg, int len)interp_set_entry (table,2 ,show_date (date, tz,0 ));interp_set_entry (table,3 ,show_rfc2822_date (date, tz));interp_set_entry (table,4 ,show_date (date, tz,1 )); +interp_set_entry (table,6 ,show_date (date, tz,DATE_ISO8601 )); } static long format_commit_message(const struct commit *commit,
@@ -791,12 +792,14 @@ static long format_commit_message(const struct commit *commit, { "%aD" }, /* author date, RFC2822 style */ { "%ar" }, /* author date, relative */ { "%at" }, /* author date, UNIX timestamp */ + { "%ai" }, /* author date, ISO 8601 */ { "%cn" }, /* committer name */ { "%ce" }, /* committer email */ { "%cd" }, /* committer date */ { "%cD" }, /* committer date, RFC2822 style */ { "%cr" }, /* committer date, relative */ { "%ct" }, /* committer date, UNIX timestamp */ + { "%ci" }, /* committer date, ISO 8601 */ { "%e" }, /* encoding */ { "%s" }, /* subject */ { "%b" }, /* body */
@@ -813,10 +816,11 @@ static long format_commit_message(const struct commit *commit,IPARENTS ,IPARENTS_ABBREV ,IAUTHOR_NAME ,IAUTHOR_EMAIL ,IAUTHOR_DATE ,IAUTHOR_DATE_RFC2822 ,IAUTHOR_DATE_RELATIVE , -IAUTHOR_TIMESTAMP , +IAUTHOR_TIMESTAMP ,IAUTHOR_ISO8601 ,ICOMMITTER_NAME ,ICOMMITTER_EMAIL ,ICOMMITTER_DATE ,ICOMMITTER_DATE_RFC2822 ,ICOMMITTER_DATE_RELATIVE ,ICOMMITTER_TIMESTAMP , +ICOMMITTER_ISO8601 ,IENCODING ,ISUBJECT , IBODY,
date.c +9 -0
@@ -137,7 +137,15 @@ const char *show_date(unsigned long time, int tz, enum date_mode mode)if (mode ==DATE_SHORT )sprintf (timebuf,"%04d-%02d-%02d" , tm->tm_year +1900 , tm->tm_mon +1 , tm->tm_mday); +else if (mode ==DATE_ISO8601 ) +sprintf (timebuf,"%04d-%02d-%02d %02d:%02d:%02d%+03d:%02d" , + tm->tm_year +1900 , + tm->tm_mon +1 , + tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec, + tz/100 , +abs (tz%100 ) + );else sprintf(timebuf, "%.3s %.3s %d %02d:%02d:%02d %d%c%+05d", weekday_names[tm->tm_wday],
Signature · 1 line
1.5.2.3
Quoted 2 lines · Robin Rosenberg
By "mutual agreement" I mean that I tell you what it looks like and you agree :)
ROTFL.
Linus
Quoted 5 lines · Jan Hudec
I apologise for nitpicking, but ISO 8601 (and RFC 3339) says separator between date and time is 'T' and there is no separator between time and timezone. So this should be
...
ISO 8601 makes separators optional, so simple 4-digit timezone is OK.
My reading of 8601 was that it is allowed to drop [T] as long as it is clear from the context by agreement between the parties involved, although I admit the only copy I have handy is JIS X0301 (2002), which is matching Japanese industrial standard that consists of translation of ISO 8601 (2000) plus Japanese "emperor's era" extensions.
Documentation/pretty-formats.txt does not talk about this addition.
Almost everything else looks fine with your patch, except that neither "git show --date=iso" nor "git log --date=iso8601" works with this change, but that is only half your fault.
When we added DATE_SHORT support we could have added the option parser to revision.c so that you could mimick it more easily. That half is my fault.
The patch, especially this hunk:
commit.c static void fill_person(struct interp *table, const char *msg, int len) · line 779
Quoted 12 lines
commit.c +1
-0@@ -773,6 +773,7 @@ static void fill_person(struct interp *table, const char *msg, int len)interp_set_entry (table,2 ,show_date (date, tz,0 ));interp_set_entry (table,3 ,show_rfc2822_date (date, tz));interp_set_entry (table,4 ,show_date (date, tz,1 )); +interp_set_entry (table,6 ,show_date (date, tz,DATE_ISO8601 )); } static long format_commit_message(const struct commit *commit,
makes me wonder if we would want to refactor and reimplement show_rfc2822_date() in terms of show_date(), by introducing DATE_RFC2822 in the date format enum, which will allow us to say "git show --date=rfc2822".
Hmm?
PATCH 1/1 Support output ISO 8601 format dates
Support output of full ISO 8601 style dates in e.g. git log and other places that use interpolation for formatting.
---
Updated docs too. The show --date is not included because I didn't know about it.
Documentation/pretty-formats.txt | 2 ++ cache.h | 2 +- commit.c | 6 +++++- date.c | 7 +++++++ 4 files changed, 15 insertions(+), 2 deletions(-)
Documentation/pretty-formats.txt +2 -0
@@ -106,12 +106,14 @@ The placeholders are: - '%aD': author date, RFC2822 style - '%ar': author date, relative - '%at': author date, UNIX timestamp +- '%ai': author date, ISO 8601 format - '%cn': committer name - '%ce': committer email - '%cd': committer date - '%cD': committer date, RFC2822 style - '%cr': committer date, relative - '%ct': committer date, UNIX timestamp +- '%ci': committer date, ISO 8601 format - '%e': encoding - '%s': subject - '%b': body
cache.h +1 -1
@@ -389,7 +389,7 @@ extern void *read_object_with_reference(const unsigned char *sha1,unsigned long *size, unsigned char *sha1_ret); -enum date_mode {DATE_NORMAL =0 ,DATE_RELATIVE ,DATE_SHORT ,DATE_LOCAL }; +enum date_mode {DATE_NORMAL =0 ,DATE_RELATIVE ,DATE_SHORT ,DATE_LOCAL ,DATE_ISO8601 };const char *show_date (unsigned long time,int timezone,enum date_mode mode);const char *show_rfc2822_date (unsigned long time,int timezone);int parse_date (const char *date,char *buf,int bufsize);
commit.c +5 -1
@@ -773,6 +773,7 @@ static void fill_person(struct interp *table, const char *msg, int len)interp_set_entry (table,2 ,show_date (date, tz,0 ));interp_set_entry (table,3 ,show_rfc2822_date (date, tz));interp_set_entry (table,4 ,show_date (date, tz,1 )); +interp_set_entry (table,6 ,show_date (date, tz,DATE_ISO8601 )); } static long format_commit_message(const struct commit *commit,
@@ -791,12 +792,14 @@ static long format_commit_message(const struct commit *commit, { "%aD" }, /* author date, RFC2822 style */ { "%ar" }, /* author date, relative */ { "%at" }, /* author date, UNIX timestamp */ + { "%ai" }, /* author date, ISO 8601 */ { "%cn" }, /* committer name */ { "%ce" }, /* committer email */ { "%cd" }, /* committer date */ { "%cD" }, /* committer date, RFC2822 style */ { "%cr" }, /* committer date, relative */ { "%ct" }, /* committer date, UNIX timestamp */ + { "%ci" }, /* committer date, ISO 8601 */ { "%e" }, /* encoding */ { "%s" }, /* subject */ { "%b" }, /* body */
@@ -813,10 +816,11 @@ static long format_commit_message(const struct commit *commit,IPARENTS ,IPARENTS_ABBREV ,IAUTHOR_NAME ,IAUTHOR_EMAIL ,IAUTHOR_DATE ,IAUTHOR_DATE_RFC2822 ,IAUTHOR_DATE_RELATIVE , -IAUTHOR_TIMESTAMP , +IAUTHOR_TIMESTAMP ,IAUTHOR_ISO8601 ,ICOMMITTER_NAME ,ICOMMITTER_EMAIL ,ICOMMITTER_DATE ,ICOMMITTER_DATE_RFC2822 ,ICOMMITTER_DATE_RELATIVE ,ICOMMITTER_TIMESTAMP , +ICOMMITTER_ISO8601 ,IENCODING ,ISUBJECT , IBODY,
date.c +7 -0
@@ -137,6 +137,13 @@ const char *show_date(unsigned long time, int tz, enum date_mode mode)if (mode ==DATE_SHORT )sprintf (timebuf,"%04d-%02d-%02d" , tm->tm_year +1900 , tm->tm_mon +1 , tm->tm_mday); +else if (mode ==DATE_ISO8601 ) +sprintf (timebuf,"%04d-%02d-%02d %02d:%02d:%02d %+05d" , + tm->tm_year +1900 , + tm->tm_mon +1 , + tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec, + tz);else sprintf(timebuf, "%.3s %.3s %d %02d:%02d:%02d %d%c%+05d", weekday_names[tm->tm_wday],
PATCH 1/1 Document new --date=<format>
Now, git-log family can take full range of internally supported date format to their --date=<format> argument. Document it.
---
* And the documentation...
Documentation/git-rev-list.txt | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-)
Documentation/git-rev-list.txt +9 -2
@@ -28,7 +28,7 @@ SYNOPSIS [ \--encoding[=<encoding>] ] [ \--(author|committer|grep)=<pattern> ] [ \--regexp-ignore-case ] [ \--extended-regexp ] - [ \--date={local|relative|default} ] + [ \--date={local|relative|default|iso|rfc|short} ] [ [\--objects | \--objects-edge] [ \--unpacked ] ] [ \--pretty | \--header ] [ \--bisect ]
@@ -96,7 +96,7 @@ include::pretty-options.txt[] Synonym for `--date=relative`. ---date={relative,local,default}:: +--date={relative,local,default,iso,rfc}:: Only takes effect for dates shown in human-readable format, such as when using "--pretty".
@@ -106,6 +106,13 @@ e.g. "2 hours ago". + `--date=local` shows timestamps in user's local timezone. + +`--date=iso` (or `--date=iso8601`) shows timestamps in ISO 8601 format. ++ +`--date=rfc` (or `--date=rfc2822`) shows timestamps in RFC 2822 +format, often found in E-mail messages. ++ +`--date=short` shows only date but not time, in `YYYY-MM-DD` fomat. ++ `--date=default` shows timestamps in the original timezone (either committer's or author's).
Signature · 1 line
1.5.3.rc1.4.gaf83
PATCH 1/2 Make show_rfc2822_date() just another date output format.
In reply to Robin RosenbergThese days, show_date() takes a date_mode parameter to specify the output format, and a separate specialized function for dates in E-mails does not make much sense anymore.
This retires show_rfc2822_date() function and make it just another date output format.
---
Quoted 2 lines · Robin Rosenberg
Updated docs too. The show --date is not included because I didn't know about it.
Thanks. Here is what I had in mind when I "wondered" aloud earlier...
cache.h | 11 +++++++++-- commit.c | 8 ++++---- date.c | 20 +++++--------------- refs.c | 4 ++-- sha1_name.c | 2 +- 5 files changed, 21 insertions(+), 24 deletions(-)
cache.h +9 -2
@@ -409,9 +409,16 @@ extern void *read_object_with_reference(const unsigned char *sha1,unsigned long *size, unsigned char *sha1_ret); -enum date_mode {DATE_NORMAL =0 ,DATE_RELATIVE ,DATE_SHORT ,DATE_LOCAL ,DATE_ISO8601 }; +enum date_mode { +DATE_NORMAL =0 , +DATE_RELATIVE , +DATE_SHORT , +DATE_LOCAL , +DATE_ISO8601 , +DATE_RFC2822 +}; +const char *show_date (unsigned long time,int timezone,enum date_mode mode); -const char *show_rfc2822_date (unsigned long time,int timezone);int parse_date (const char *date,char *buf,int bufsize);void datestamp (char *buf,int bufsize);unsigned long approxidate (const char *);
commit.c +4 -4
@@ -585,7 +585,7 @@ static int add_user_info(const char *what, enum cmit_fmt fmt, char *buf,break ;case CMIT_FMT_EMAIL : ret +=sprintf (buf + ret,"Date: %s\n" , -show_rfc2822_date (time, tz)); +show_date (time, tz,DATE_RFC2822 ));break ;case CMIT_FMT_FULLER : ret += sprintf(buf + ret, "%sDate: %s\n", what,
@@ -778,9 +778,9 @@ static void fill_person(struct interp *table, const char *msg, int len) tz = -tz; } -interp_set_entry (table,2 ,show_date (date, tz,0 )); -interp_set_entry (table,3 ,show_rfc2822_date (date, tz)); -interp_set_entry (table,4 ,show_date (date, tz,1 )); +interp_set_entry (table,2 ,show_date (date, tz,DATE_NORMAL )); +interp_set_entry (table,3 ,show_date (date, tz,DATE_RFC2822 )); +interp_set_entry (table,4 ,show_date (date, tz,DATE_RELATIVE ));interp_set_entry (table,6 ,show_date (date, tz,DATE_ISO8601 )); }
date.c +5 -15
@@ -144,6 +144,11 @@ const char *show_date(unsigned long time, int tz, enum date_mode mode) tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, tz); + else if (mode == DATE_RFC2822) + sprintf(timebuf, "%.3s, %d %.3s %d %02d:%02d:%02d %+05d", + weekday_names[tm->tm_wday], tm->tm_mday, + month_names[tm->tm_mon], tm->tm_year +1900 , + tm->tm_hour, tm->tm_min, tm->tm_sec, tz); else sprintf(timebuf, "%.3s %.3s %d %02d:%02d:%02d %d%c%+05d", weekday_names[tm->tm_wday],
@@ -156,21 +161,6 @@ const char *show_date(unsigned long time, int tz, enum date_mode mode)return timebuf; } -const char *show_rfc2822_date (unsigned long time,int tz) -{ -struct tm *tm; -static char timebuf[200 ]; - - tm =time_to_tm (time, tz); -if (!tm) -return NULL ; -sprintf (timebuf,"%.3s, %d %.3s %d %02d:%02d:%02d %+05d" , - weekday_names[tm->tm_wday], tm->tm_mday, - month_names[tm->tm_mon], tm->tm_year +1900 , - tm->tm_hour, tm->tm_min, tm->tm_sec, tz); -return timebuf; -} -/* * Check these. And note how it doesn't do the summer-time conversion. *
refs.c +2 -2
@@ -1300,7 +1300,7 @@ int read_ref_at(const char *ref, unsigned long at_time, int cnt, unsigned char *if (hashcmp (logged_sha1, sha1)) {fprintf (stderr,"warning: Log %s has gap after %s.\n" , - logfile,show_rfc2822_date (date, tz)); + logfile,show_date (date, tz,DATE_RFC2822 )); } }else if (date == at_time) {
@@ -1313,7 +1313,7 @@ int read_ref_at(const char *ref, unsigned long at_time, int cnt, unsigned char *if (hashcmp (logged_sha1, sha1)) {fprintf (stderr,"warning: Log %s unexpectedly ended on %s.\n" , - logfile,show_rfc2822_date (date, tz)); + logfile,show_date (date, tz,DATE_RFC2822 )); } }munmap (log_mapped, mapsz);
sha1_name.c +1 -1
@@ -370,7 +370,7 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)fprintf (stderr,"warning: Log for '%.*s' only goes " "back to %s.\n" , len, str, -show_rfc2822_date (co_time, co_tz)); +show_date (co_time, co_tz,DATE_RFC2822 )); else fprintf(stderr,"warning: Log for '%.*s' only has "
Signature · 1 line
1.5.3.rc1.4.gaf83
PATCH 2/2 Wire new date formats to --date=<format> parser.
In reply to Robin RosenbergNow we can use all internally supported date formats with
git log --date=<format>
syntax. Earlier, we only allowed relative/local/default.
--- revision.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
revision.c +8 -0
@@ -1133,6 +1133,14 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const chif (!strncmp (arg,"--date=" ,7 )) {if (!strcmp (arg +7 ,"relative" )) revs->date_mode =DATE_RELATIVE ; +else if (!strcmp (arg +7 ,"iso8601" ) || + !strcmp (arg +7 ,"iso" )) + revs->date_mode =DATE_ISO8601 ; +else if (!strcmp (arg +7 ,"rfc2822" ) || + !strcmp (arg +7 ,"rfc" )) + revs->date_mode =DATE_RFC2822 ; +else if (!strcmp (arg +7 ,"short" )) + revs->date_mode =DATE_SHORT ;else if (!strcmp (arg +7 ,"local" )) revs->date_mode =DATE_LOCAL ;else if (!strcmp (arg +7 ,"default" ))
Signature · 1 line
1.5.3.rc1.4.gaf83
Re: [PATCH 2/2] Wire new date formats to --date=<format> parser.
revision.c int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch · line 1140
Quoted 11 lines · Junio C Hamano
revision.c +5
-0@@ -1133,6 +1133,14 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const chif (!strncmp (arg,"--date=" ,7 )) {if (!strcmp (arg +7 ,"relative" )) revs->date_mode =DATE_RELATIVE ; +else if (!strcmp (arg +7 ,"iso8601" ) || + !strcmp (arg +7 ,"iso" )) + revs->date_mode =DATE_ISO8601 ; +else if (!strcmp (arg +7 ,"rfc2822" ) || + !strcmp (arg +7 ,"rfc" ))
Maybe also add "rfc822"?
revision.c int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch · line 1146
Quoted 6 lines
revision.c +3
-0+ revs->date_mode =DATE_RFC2822 ; + else if (!strcmp(arg + 7, "short")) + revs->date_mode =DATE_SHORT ; else if (!strcmp(arg + 7, "local")) revs->date_mode =DATE_LOCAL ; else if (!strcmp(arg + 7, "default"))
MfG, JBG
Signature · 3 lines
Jan-Benedict Glaw [email protected] +49-172-7608481 Signature of: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html the second :
Re: [PATCH 2/2] Wire new date formats to --date=<format> parser.
Quoted 14 lines · Jan-Benedict Glaw
revision.c int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch · line 1140
Quoted 11 lines · Junio C Hamano
revision.c +5
-0@@ -1133,6 +1133,14 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const chif (!strncmp (arg,"--date=" ,7 )) {if (!strcmp (arg +7 ,"relative" )) revs->date_mode =DATE_RELATIVE ; +else if (!strcmp (arg +7 ,"iso8601" ) || + !strcmp (arg +7 ,"iso" )) + revs->date_mode =DATE_ISO8601 ; +else if (!strcmp (arg +7 ,"rfc2822" ) || + !strcmp (arg +7 ,"rfc" ))Maybe also add "rfc822"?
I've thought about it, but did not bother; I suspect people would just say "rfc" anyway.
Re: [PATCH 2/2] Wire new date formats to --date=<format> parser.
In reply to Junio C Hamanolördag 14 juli 2007 skrev Junio C Hamano:
Quoted 7 lines
Now we can use all internally supported date formats with
git log --date=<format>syntax. Earlier, we only allowed relative/local/default.
Signed-off-by Junio C Hamano <[email protected]>
Ack, 1/2 and 2/2.
-- robin