summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2013-09-13 15:08:37 +0000
committerMichał Górny <mgorny@gentoo.org>2013-09-13 15:08:37 +0000
commit7538ca7011ad7a369e61d23140da52e7b7e2d689 (patch)
tree3915b4f65b28782f7c492f42c0968123c1781f16 /eclass/git-r3.eclass
parentDo not leak EGIT_NONSHALLOW over loop iterations. Failing URL may cause non-s... (diff)
downloadhistorical-7538ca7011ad7a369e61d23140da52e7b7e2d689.tar.gz
historical-7538ca7011ad7a369e61d23140da52e7b7e2d689.tar.bz2
historical-7538ca7011ad7a369e61d23140da52e7b7e2d689.zip
Fail early on unreachable URLs. If ls-remote fails due to server being unreachable, there is no point in attempting to fetch.
Diffstat (limited to 'eclass/git-r3.eclass')
-rw-r--r--eclass/git-r3.eclass7
1 files changed, 5 insertions, 2 deletions
diff --git a/eclass/git-r3.eclass b/eclass/git-r3.eclass
index d2e87df5da84..457d41352303 100644
--- a/eclass/git-r3.eclass
+++ b/eclass/git-r3.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v 1.4 2013/09/13 15:04:36 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v 1.5 2013/09/13 15:08:37 mgorny Exp $
# @ECLASS: git-r3.eclass
# @MAINTAINER:
@@ -398,9 +398,12 @@ git-r3_fetch() {
# split on whitespace
local ref=(
- $(git ls-remote "${r}" "${lookup_ref}")
+ $(git ls-remote "${r}" "${lookup_ref}" || echo __FAIL__)
)
+ # normally, ref[0] is a hash, so we can do magic strings here
+ [[ ${ref[0]} == __FAIL__ ]] && continue
+
local nonshallow=${EGIT_NONSHALLOW}
local ref_param=()
if [[ ! ${ref[0]} ]]; then