Subject: Re: [PATCH] --format=pretty: new modifiers cID, cIS, CIY

From: Junio C Hamano <[email-masked]>
Date: Fri, 01 Feb 2008 15:04:15 -0800

Jari Aalto <[email-masked]> 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 <[email-masked]>

(23 is because US/Pacific is 8 hours behind right now).

Of course, %a(likewise for author time) can be defined the same
way.