Dont clone already existing repository
This commit is contained in:
parent
d6ef67f6c5
commit
90295c4bef
|
@ -18,14 +18,20 @@ if [ -d "$GCLONE_PATH" ]; then
|
||||||
repo=${repo%.*}
|
repo=${repo%.*}
|
||||||
fi
|
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`
|
tempdir=`mktemp -d`
|
||||||
git clone $1 $tempdir/$repo
|
git clone $1 $tempdir/$repo
|
||||||
|
|
||||||
# If the clone worked, move the repo in the good place
|
# If the clone worked, move the repo in the good place
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
|
|
||||||
# Final path to the repo
|
|
||||||
repo_path=$GCLONE_PATH/$server/$user
|
|
||||||
mkdir -p $repo_path
|
mkdir -p $repo_path
|
||||||
|
|
||||||
mv $tempdir/$repo $repo_path
|
mv $tempdir/$repo $repo_path
|
||||||
|
|
Loading…
Reference in New Issue