Browse Source

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

Tianon Gravi 11 years ago
parent
commit
17b5e5ed96
1 changed files with 4 additions and 1 deletions
  1. 4 1
      bashbrew/build.sh

+ 4 - 1
bashbrew/build.sh

@@ -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