summaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorYann E. MORIN <yann.morin.1998@free.fr>2014-07-07 23:44:33 +0200
committerPeter Korsgaard <peter@korsgaard.com>2014-07-08 23:26:48 +0200
commitebe6154ff4b2a7399f6d3b66dba01c71237cf133 (patch)
tree43e5a7ad4438c1cbf8cc871ff1e9a2990bb81362 /support
parent0fbba2cef24421552d21112e845cf9603a32a816 (diff)
support/download: fix the git helper
When switching the git helper over to a shell script, a special case was not carried over: in case the remote has the required reference, we attempt a shallow clone, using --depth 1. However, this is not supported when the remote is accessed with the http protocol. Therefore, the download fails. What happened before the conversion to a shell script was that the helper in the Makefile would fallback to doing a full-clone. This is the case and behaviour that were lost in the conversion. To avoid making the script too complex, we only attempt a full clone if needed. And we decide that a full clone is needed by default; we decide it is unnecessary if the remote has the needed reference *and* the shallow clone was successful. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Diffstat (limited to 'support')
-rwxr-xr-xsupport/download/git8
1 files changed, 6 insertions, 2 deletions
diff --git a/support/download/git b/support/download/git
index badb491ef..116e5a903 100755
--- a/support/download/git
+++ b/support/download/git
@@ -33,10 +33,14 @@ cd "${BUILD_DIR}"
# Remove leftovers from a previous failed run
rm -rf "${repodir}"
+git_done=0
if [ -n "$(${GIT} ls-remote "${repo}" "${cset}" 2>&1)" ]; then
printf "Doing shallow clone\n"
- ${GIT} clone --depth 1 -b "${cset}" --bare "${repo}" "${repodir}"
-else
+ if ${GIT} clone --depth 1 -b "${cset}" --bare "${repo}" "${repodir}"; then
+ git_done=1
+ fi
+fi
+if [ ${git_done} -eq 0 ]; then
printf "Doing full clone\n"
${GIT} clone --bare "${repo}" "${repodir}"
fi