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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jari Aalto <jari.aalto@xxxxxxxxx> 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@xxxxxxxxx>

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

Of course, %a(likewise for author time) can be defined the same
way.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux