]> git.somenet.org - root/pub/somesible.git/blob - roles/server/git-server/files/default/compact_gitolite_repos.sh
[roles/server/mail/milter-dmarc] setup dmarc milter
[root/pub/somesible.git] / roles / server / git-server / files / default / compact_gitolite_repos.sh
1 #!/bin/bash
2 ################################################
3 ### Managed by someone's ansible provisioner ###
4 ################################################
5 # Part of: https://git.somenet.org/root/pub/somesible.git
6 # 2017-2024 by someone <someone@somenet.org>
7 #
8
9 date -Isec > /tmp/compactGitRepos.txt
10 echo "------OLD------" >> /tmp/compactGitRepos.txt
11 find /srv/gitolite/repositories -path '*.git' -type d -print0 | sort -z | du -scm --files0-from=- >> /tmp/compactGitRepos.txt
12 echo "------NEW------" >> /tmp/compactGitRepos.txt
13 find /srv/gitolite/repositories -path '*.git/config' -type f -execdir echo "------------------------------------------" \; -execdir pwd \; -execdir git gc --prune=all \;
14 find /srv/gitolite/repositories -path '*.git' -type d -print0 | sort -z | du -scm --files0-from=- > /tmp/compactGitRepos.new.txt
15 echo "-----STATS-----"
16 cat /tmp/compactGitRepos.txt
17 cat /tmp/compactGitRepos.new.txt
18 echo "$(grep 'total$' /tmp/compactGitRepos.txt) before"
19 echo "repo count: `echo "$(cat /tmp/compactGitRepos.new.txt|wc -l)-1" | bc`"
20 rm -f /tmp/compactGitRepos.txt /tmp/compactGitRepos.new.txt