From: Junio C Hamano <gitster@pobox.com>
To: Jari Aalto <jari.aalto@cante.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] --format=pretty: new modifiers cID, cIS, CIY
Date: Fri, 01 Feb 2008 15:04:15 -0800 [thread overview]
Message-ID: <7vir188ej4.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <odb072ca.fsf@blue.sea.net> (Jari Aalto's message of "Sat, 02 Feb 2008 00:12:53 +0200")
Jari Aalto <jari.aalto@cante.net> writes:
> + case 'I': /* date, ISO 8601 + fine grained details */
> + switch (next) {
> + case 'D': /* up till date */
> + strbuf_addstr(sb,
> + show_date(date, tz,
> + DATE_ISO8601_YYYYMMDD));
> + return;
> + case 'S': /* up till date + sec */
> + strbuf_addstr(sb,
> + show_date(date, tz,
> + DATE_ISO8601_YYYYMMDDHHMMSS));
> +
> + return;
> + default: /* up till hour */
> + strbuf_addstr(sb,
> + show_date(date, tz,
> + DATE_ISO8601_YYYYMMDDHHMM));
> +
> + }
> + return;
I think this "default" is not quite nice. If you want to
support down-to-hour, you'd beter explicitly support 'H'.
"default:" should error out, saying "Ah, oh, sorry, I do not
support %cIX (yet)".
Otherwise, it casts the set of truncated ISO 8601 date format we
supports in stone. People would depend on being able to say
"%cIhour" and a new implementation cannot introduce %cIh
modifier that means something.
But I do not like the idea of adding more short-hand format this
way. I think we would very much prefer, instead of piling hacks
on top of the originally supported "minimum set", to introduce a
truly extensible syntax, like:
%cT(flexible formatting specification for committer time)
or even
%c(flexible formatting specification for committer info)
and that specification may say which field to format with what
prettiness. For example:
%c(name|initial) %c(time|local,HH:MM) %c(time|gmt,HH) <%c(email)>
might say:
JCH 15:00 23 <gitster@pobox.com>
(23 is because US/Pacific is 8 hours behind right now).
Of course, %a(likewise for author time) can be defined the same
way.
next prev parent reply other threads:[~2008-02-01 23:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-01 22:12 [PATCH] --format=pretty: new modifiers cID, cIS, CIY Jari Aalto
2008-02-01 22:43 ` [PATCH] --format=pretty: new modifiers cID, cIM, CIS Jari Aalto
2008-02-01 23:04 ` Junio C Hamano [this message]
2008-02-01 23:16 ` [PATCH] --format=pretty: new modifiers cID, cIS, CIY Tommy Thorn
2008-02-01 23:29 ` Junio C Hamano
2008-02-02 1:12 ` Jari Aalto
2008-02-02 1:15 ` Jari Aalto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vir188ej4.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jari.aalto@cante.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).