New Script: trimrepo.sh: trim blobs from history
Former-commit-id: 4cbb392769c51f1cad72a49f39e162bdf1eeeea5 [formerly 7399811e55482ed592db0afb02558105232c95fb] [formerly e136ec62efe655d1d11a933d4a7dc7d5a0be7676] Former-commit-id: ea9ffb1557cc19fddee168974f9e10f788164f95 Former-commit-id: d780d1815ada5f008abce6712d8f21bb81df9532
This commit is contained in:
parent
357f933345
commit
f0027a41ce
46
trimrepo.sh
Executable file
46
trimrepo.sh
Executable file
@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
chk_deps()
|
||||
{
|
||||
if [ ! -f /usr/bin/tux ] || [ ! -f /usr/bin/sudo ];then
|
||||
echo "Please install: tuxc & sudo, one of them was not found"
|
||||
exit 1
|
||||
|
||||
|
||||
sudo tux i openjdk-8-jre wget
|
||||
fi
|
||||
}
|
||||
|
||||
dl_bins()
|
||||
{
|
||||
file_name="bfg"
|
||||
file_version="1.13.0"
|
||||
dldest="./"
|
||||
dltool="wget"
|
||||
dlurl="https://repo1.maven.org/maven2/com/madgag/bfg/${file_version}/${file_name}-${file_version}.jar"
|
||||
|
||||
if [ -f ./bfg-1.13.0.jar ];then
|
||||
echo "${file_name}-${file_version} already exists"
|
||||
return
|
||||
elif [ ${dltool} = "wget" ];then
|
||||
${dltool} ${dlurl} -P ${dldest}
|
||||
|
||||
elif [ ${dltool} = "aria2c" ];then
|
||||
${dltool} -x 10 -j 10 ${dlurl} -d ${dldest}
|
||||
fi
|
||||
}
|
||||
|
||||
chk_deps
|
||||
dl_bins
|
||||
|
||||
trim_size="10M"
|
||||
|
||||
if [ ! -d .git/ ];then
|
||||
echo "This is not a git repository"
|
||||
|
||||
else
|
||||
java -jar ./${file_name}-${file_version}.jar --strip-blobs-bigger-than ${trim_size}
|
||||
git reflog expire --expire=now --all && git gc --prune=now --aggressive
|
||||
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user