Dont clone already existing repository

This commit is contained in:
2018-10-08 11:18:15 +02:00
parent d6ef67f6c5
commit 90295c4bef

View File

@@ -18,14 +18,20 @@ if [ -d "$GCLONE_PATH" ]; then
repo=${repo%.*}
fi
# Final path to the repo
repo_path=$GCLONE_PATH/$server/$user
if [ -d $repo_path ]; then
echo "Repository already exists"
return 1
fi
tempdir=`mktemp -d`
git clone $1 $tempdir/$repo
# If the clone worked, move the repo in the good place
if [ $? -eq 0 ]; then
# Final path to the repo
repo_path=$GCLONE_PATH/$server/$user
mkdir -p $repo_path
mv $tempdir/$repo $repo_path