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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: Regress failures: regress, histedit
To:
Christian Weisgerber <naddy@mips.inka.de>
Cc:
gameoftrees@openbsd.org
Date:
Mon, 30 Aug 2021 16:15:42 +0200

Download raw body.

Thread
On Sun, Aug 29, 2021 at 05:26:33PM +0200, Christian Weisgerber wrote:
> got.c:print_path_info
>   This is the output of "info <file>", e.g.
>     $ got info Makefile
>     [...]
>     file: Makefile
>     mode: 644
>     timestamp: Wed Jun 23 22:35:53 2021 CEST
>     based on blob: 5e96ac3cb604c6c6ffb943a5f7620395583905f4
>     based on commit: 535e07c7d678cfc4a2b6ad61f72c36e0a46e5111
> 
>   That appears to reflect stat.st_mtim.
>   => ?? I don't know.

This value is stored in the file index to allow 'got status' to skip
expensive content comparison for files which did not see an mtime
change since the last time they were visited. It does not serve any
other purpose and is not exposed to the repository.

I think localtime makes sense here since it will match the values
displayed by stat(1) and ls(1).

> I guess the actual code change is as simple as s/localtime_r/gmtime_r/.

Patch below. ok?

diff 92952c0ecd960182cd5822e21126351bff23ad61 /home/stsp/src/got
blob - f48598b57aa7474d4174c928c96d948834824f21
file + got/got.c
--- got/got.c
+++ got/got.c
@@ -4659,8 +4659,8 @@ 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 (gmtime_r(&committer_time, &tm) == NULL)
+		return got_error_from_errno("gmtime_r");
 	if (strftime(bline->datebuf, sizeof(bline->datebuf), "%G-%m-%d",
 	    &tm) == 0) {
 		err = got_error(GOT_ERR_NO_SPACE);
@@ -8414,8 +8414,8 @@ get_commit_brief_str(char **brief_str, struct got_comm
 	char *logmsg0 = NULL, *logmsg, *newline;
 
 	committer_time = got_object_commit_get_committer_time(commit);
-	if (localtime_r(&committer_time, &tm) == NULL)
-		return got_error_from_errno("localtime_r");
+	if (gmtime_r(&committer_time, &tm) == NULL)
+		return got_error_from_errno("gmtime_r");
 	if (strftime(datebuf, sizeof(datebuf), "%G-%m-%d", &tm) == 0)
 		return got_error(GOT_ERR_NO_SPACE);
 
blob - 7d851f4f247951408191157cdfd7b2a4a3eb97e0
file + gotweb/gotweb.c
--- gotweb/gotweb.c
+++ gotweb/gotweb.c
@@ -3909,8 +3909,8 @@ gw_blame_cb(void *arg, int nlines, int lineno, struct 
 	}
 
 	committer_time = got_object_commit_get_committer_time(commit);
-	if (localtime_r(&committer_time, &tm) == NULL)
-		return got_error_from_errno("localtime_r");
+	if (gmtime_r(&committer_time, &tm) == NULL)
+		return got_error_from_errno("gmtime_r");
 	if (strftime(bline->datebuf, sizeof(bline->datebuf), "%G-%m-%d",
 	    &tm) == 0) {
 		err = got_error(GOT_ERR_NO_SPACE);
blob - c175ea3c10692ebe9286741d643cd9b65fb4140c
file + tog/tog.c
--- tog/tog.c
+++ tog/tog.c
@@ -1340,8 +1340,8 @@ draw_commit(struct tog_view *view, struct got_commit_o
 	struct tog_color *tc;
 
 	committer_time = got_object_commit_get_committer_time(commit);
-	if (localtime_r(&committer_time, &tm) == NULL)
-		return got_error_from_errno("localtime_r");
+	if (gmtime_r(&committer_time, &tm) == NULL)
+		return got_error_from_errno("gmtime_r");
 	if (strftime(datebuf, sizeof(datebuf), "%G-%m-%d ", &tm) == 0)
 		return got_error(GOT_ERR_NO_SPACE);