From 485be7c55f119e3bcd1cd286bde8018b862091b5 Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Tue, 27 Feb 2024 21:27:05 +0100 Subject: [PATCH] Initial commit --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..1edd402 --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +# Update Gitea repo last updated time + +Silly Gitea considers repositories updated when their description or other +properties are updated. I prefer last update time to indicate the last commit +instead. This script generates SQL that can be used to fix this discrepancy. + +# Use + +Connect to the gitea container, e.g. `docker exec -it gitea /bin/bash` + +Allow executing commands on repos: + +``` +git config --global --add safe.directory '*' +``` + +Run the following script to generate update statements: + +``` +#!/bin/bash + +OWNER=localhots + +cd /data/git/repositories/$OWNER +for d in */; do + cd $d && ts=$(git --no-pager log -1 --format="%at") && cd - >/dev/null + repo=${d::-5} # Trim .git suffix + echo "UPDATE repository SET updated_unix=$ts WHERE owner_name='$OWNER' AND name='$repo';" +done +``` + +Connect to the Postgres container, e.g. `docker exec -it gitea-postgres` /bin/bash` +and execute the statements from the previous step. Done.