From dc633d25bab61d17d429428d5a8128dc75a354ed Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 3 Oct 2014 11:45:34 -0600 Subject: [PATCH] Fix "git fetch" lines to work in "detached head" state --- build.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index ebb12ab..ccfe8a4 100755 --- a/build.sh +++ b/build.sh @@ -183,8 +183,15 @@ for repoTag in "${repos[@]}"; do echo 'Cloned successfully!' else # 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 ) + if ! ( + cd "$gitRepo" + git rev-parse --verify "${gitRef}^{commit}" &> /dev/null + ); then + ( + cd "$gitRepo" + git fetch -q --all + git fetch -q --tags + ) fi fi