zero-based indexing, not 1-based

main
Andrew Coleman 2021-04-16 13:23:52 -04:00
parent c81c8ecba2
commit d589c3fda9
1 changed files with 4 additions and 5 deletions

View File

@ -1,6 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -x
GITEA_HOST=${GITEA_HOST:-$1} GITEA_HOST=${GITEA_HOST:-$1}
if [ -z "$GITEA_HOST" ] || [ -z "$GITEA_ACCESS_TOKEN" ] ; then if [ -z "$GITEA_HOST" ] || [ -z "$GITEA_ACCESS_TOKEN" ] ; then
@ -26,11 +25,11 @@ for i in $(curl -s --header "Authorization: token $GITEA_ACCESS_TOKEN" "${GITEA_
fi fi
fi fi
else else
if [ -d "${fields[1]}" ] ; then if [ -d "${fields[0]}" ] ; then
echo "Repo ${fields[1]} already exists, skipping." echo "Repo ${fields[0]} already exists, skipping."
else else
echo "Cloning ${fields[1]} from ${fields[2]}" echo "Cloning ${fields[0]} from ${fields[1]}"
git clone -q "${fields[2]}" git clone -q "${fields[1]}"
fi fi
fi fi
done done