move old files to old directory

Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
2022-05-04 09:46:41 +02:00
parent 3d12f83d26
commit b536c883de
28 changed files with 0 additions and 0 deletions

50
old/src/mirror-main-repo Executable file
View File

@@ -0,0 +1,50 @@
#!/bin/bash
#
# Just mirror (clone or fetch) specified git repository
# - no other mess (eg submodules, just clean mirror)
#
# Usage:
# mirror-main-repo <url>
# Unofficial strict mode
set -euo pipefail
IFS=$'\n\t'
source $(dirname $(realpath $0))/gen-mirror-path
function updateOrCreate(){
url=$1
repodir=$(getRepoPath $url)
if [ ! -d $repodir ]
then
echo "Clone of $url"
git clone --bare --mirror $url $repodir
# create FETCH_HEAD needed by other scripts
cd $repodir
git fetch --prune
else
cd $repodir
echo "Update of $url"
git fetch --prune
fi
}
function getLastCommit(){
url=$1
repodir=$(getRepoPath $url)
if [ -d $repodir ]
then
cd $repodir
git --no-pager log --full-history --all -1 --pretty=format:"%H%n"
else
echo '-'
fi
}
oldPwd=$(pwd)
updateOrCreate $1
cd $oldPwd