Download raw body.
tog add century
On Tue, Dec 03, 2019 at 04:18:03PM +0100, Stefan Sperling wrote:
> On Tue, Dec 03, 2019 at 08:02:54AM -0700, Tracey Emery wrote:
> > > > > How about YYYYMMDD without the /?
> > > > 
> > > > Would it be obvious that such a number is supposed to represent a date?
> > > 
> > > It would to me (especially with the full year), but possibly not everyone!
> > 
> > It would be to me as well. However, that comes from a lot of database
> > and archiving work where the chronological ordering of the format is
> > automatic.
> 
> One problem with YYYYMMDD in tog is that it looks inconsistent with output
> used elsewhere, e.g. in 'got blame'. I'd prefer abbreviated dates to
> be written out somewhat consistently across all commands. We could of
> course switch to YYYYMMDD everywhere if it is the preferred format.
Here's a trivial patch to do this. Would anyone be opposed to it?
diff --git a/got/got.c b/got/got.c
index 756eaa2..9aa888c 100644
--- a/got/got.c
+++ b/got/got.c
@@ -2518,7 +2518,7 @@ blame_cb(void *arg, int nlines, int lineno, struct got_object_id *id)
 	committer_time = got_object_commit_get_committer_time(commit);
 	if (localtime_r(&committer_time, &tm) == NULL)
 		return got_error_from_errno("localtime_r");
-	if (strftime(bline->datebuf, sizeof(bline->datebuf), "%G/%m/%d",
+	if (strftime(bline->datebuf, sizeof(bline->datebuf), "%G%m%d",
 	    &tm) >= sizeof(bline->datebuf)) {
 		err = got_error(GOT_ERR_NO_SPACE);
 		goto done;
diff --git a/tog/tog.c b/tog/tog.c
index 06adcab..0620d29 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -1219,7 +1219,7 @@ draw_commit(struct tog_view *view, struct got_commit_object *commit,
 	committer_time = got_object_commit_get_committer_time(commit);
 	if (localtime_r(&committer_time, &tm) == NULL)
 		return got_error_from_errno("localtime_r");
-	if (strftime(datebuf, sizeof(datebuf), "%g/%m/%d ", &tm)
+	if (strftime(datebuf, sizeof(datebuf), "%G%m%d ", &tm)
 	    >= sizeof(datebuf))
 		return got_error(GOT_ERR_NO_SPACE);
 
tog add century