"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: blame display
To:
Tracey Emery <tracey@traceyemery.net>, gameoftrees@openbsd.org
Date:
Mon, 21 Oct 2019 15:22:31 +0200

Download raw body.

Thread
On Sat, Oct 19, 2019 at 07:29:33PM +0200, Stefan Sperling wrote:
> On Sat, Oct 19, 2019 at 10:07:37AM -0600, Tracey Emery wrote:
> > Hello,
> > 
> > In got blame, is there some rationale to using a two-digit year over a
> > four-digit year? Just curious. It looks funny to me and made me feel
> > like it was 1997.
> 
> I think I copied this from tog's log view where it would otherwise steal
> the first two display columns just to display "19" or "20".
> (I doubt this code will survive into the 22nd century.)
> 
> > Does it make sense to move it to four digits?
> 
> In got's case, line length isn't an issue, so yes, I don't see why not.

Since nobody else spoke up, I have decided to commit this. Sorry, this
patch could have made the 0.18 release but I had forgotten about it.

Your patch broke the blame.sh tests. Please always run 'make regress'
and adjust expected output in tests. It was trivial to deal with in
this case, but sometimes it's more involved.

Cheers!

> > diff a651202a0e6ce0b79e1be76ebf349a28f4c40bb8 /home/basepr1me/Documents/got/public/got
> > blob - 5423c33764d81bfc3fd2c71dc7f9ca32f22bad4a
> > file + got/got.c
> > --- got/got.c
> > +++ got/got.c
> > @@ -2349,7 +2349,7 @@ struct blame_line {
> >  	int annotated;
> >  	char *id_str;
> >  	char *committer;
> > -	char datebuf[9]; /* YY-MM-DD + NUL */
> > +	char datebuf[11]; /* YYYY-MM-DD + NUL */
> >  };
> >  
> >  struct blame_cb_args {
> > @@ -2406,7 +2406,7 @@ blame_cb(void *arg, int nlines, int lineno, struct got
> >  	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;
> > 
> > 
> 
>