Initial commit

This commit is contained in:
Gregory Eremin 2024-02-27 21:27:05 +01:00
commit 485be7c55f
1 changed files with 33 additions and 0 deletions

33
README.md Normal file
View File

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