瀏覽代碼

Merge pull request #242 from infosiftr/git-fetch

Fix "git fetch" lines to work in "detached head" state
yosifkit 11 年之前
父節點
當前提交
4b09e7f49b
共有 1 個文件被更改,包括 9 次插入2 次删除
  1. 9 2
      bashbrew/build.sh

+ 9 - 2
bashbrew/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