Update, repo tool cloner: recursive clones

Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
2022-07-29 17:03:15 +02:00
parent 8a150c63c5
commit 6463a6bb95
6 changed files with 142 additions and 65 deletions

View File

@@ -13,38 +13,12 @@ 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
# implemented in RepoTool
}
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
# replaced by git_tool repo hash
}
oldPwd=$(pwd)
updateOrCreate $1
cd $oldPwd
updateOrCreate $1