Update "git fetch" with intelligence about when to go fetch (ie, if we don't have the ref specified)

This commit is contained in:
Tianon Gravi 2014-09-22 09:40:40 -06:00
parent 9a4bbd34b2
commit 143ac14d2a
1 changed files with 4 additions and 1 deletions

View File

@ -147,7 +147,10 @@ for repoTag in "${repos[@]}"; do
git clone -q "$gitUrl" "$gitRepo"
echo 'Cloned successfully!'
else
( cd "$gitRepo" && git fetch -q && git fetch -q --tags )
# if we don't have the "ref" specified, "git fetch" in the hopes that we get it
if ! ( cd "$gitRepo" && git rev-parse --verify "${gitRef}^{commit}" &> /dev/null ); then
( cd "$gitRepo" && git fetch -q && git fetch -q --tags )
fi
fi
fi