"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>
Cc:
gameoftrees@openbsd.org
Date:
Sat, 19 Oct 2019 19:29:33 +0200

Download raw body.

Thread
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.

> 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;
> 
>