From ebdb5f3a6a3aa4c4f5bc66005164536dc763ff95 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 | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..382eb8d --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +# 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`. + +Start the Postgres client, e.g. `psql -U gitea gitea`. + +Execute the statements from the previous step. + +Done.