Thread (4 messages) flat view 4 messages, 3 authors, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:44:09

Possibly related (same subject, not in this thread)

Jari Aalto [off-list ref] 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 [off-list ref]

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

Of course, %a(likewise for author time) can be defined the same
way.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help