diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Date a reftable repository on the index
The idle column falls back on the mtime of the branch's loose ref or of packed-refs, and a reftable repository has neither, so its cell stayed empty. Git rewrites reftable/tables.list on every ref update.
-rw-r--r--source/ui-repolist.c10
-rwxr-xr-xtests/t0303-robustness.sh5
2 files changed, 15 insertions, 0 deletions
diff --git a/source/ui-repolist.c b/source/ui-repolist.c
index 1c081c7..99474c1 100644
--- a/source/ui-repolist.c
+++ b/source/ui-repolist.c
@@ -115,6 +115,16 @@ static int get_repo_modtime(const struct cgit_repo *repo, time_t *mtime)
goto end;
}
+ // A reftable repository has neither file, but rewrites this list on
+ // every ref update.
+ strbuf_reset(&path);
+ strbuf_addf(&path, "%s/reftable/tables.list", repo->path);
+ if (stat(path.buf, &st) == 0) {
+ *mtime = st.st_mtime;
+ writable->mtime = *mtime;
+ goto end;
+ }
+
*mtime = 0;
writable->mtime = *mtime;
end:
diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh
index 14bdca7..848b03a 100755
--- a/tests/t0303-robustness.sh
+++ b/tests/t0303-robustness.sh
@@ -616,6 +616,11 @@ test_expect_success 'the dumb transport answers HEAD from the refs' '
test_cmp expect head
'
+test_expect_success 'a reftable repository shows its age on the index' '
+ CGIT_CONFIG="$PWD/rtrc" QUERY_STRING="url=" cgit >tmp &&
+ grep "<td class=.col-idle.><time " tmp
+'
+
# A client that goes away mid-page leaves nobody to send an error page to,
# so the request ends quietly instead of dying twice into the log. The page
# has to outgrow the pipe for the write after the reader has gone to fail.