Making cgit show real idle time after migration

Look at the source of cgit's get_repo_modtime function: https://github.com/zx2c4/cgit/blob/master/ui-repolist.c#L35.

When agefile is not present, it just reads mtime of refs/heads/master (or other head) and uses it in the idle column in the UI.

So we need to "synchronize" the mtimes of those files with timestamps of latest commits.

In cgit's scan-path root:

for d in *; do [ -d "$d" ] || continue; cd $d; git rev-parse --git-dir 1>/dev/null 2>/dev/null && touch -m --date @$(git log -1 --format=%ct) $(git show-ref | awk '{print $2}') && echo "$d done"; cd ..; done
If you have any comments, contact me by email.
powered by OpenBSD
© ch1p 2021