From patchwork Mon Jul 7 21:44:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 367734 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id BACF51400BB for ; Tue, 8 Jul 2014 07:44:53 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 0CC1B31CAD; Mon, 7 Jul 2014 21:44:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gCV+p6aRMxTs; Mon, 7 Jul 2014 21:44:45 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id E5871305E8; Mon, 7 Jul 2014 21:44:44 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 72C8E1BF96A for ; Mon, 7 Jul 2014 21:44:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 6E1C38813B for ; Mon, 7 Jul 2014 21:44:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZJHXtM584eAs for ; Mon, 7 Jul 2014 21:44:43 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wg0-f48.google.com (mail-wg0-f48.google.com [74.125.82.48]) by hemlock.osuosl.org (Postfix) with ESMTPS id C77CD87AC6 for ; Mon, 7 Jul 2014 21:44:42 +0000 (UTC) Received: by mail-wg0-f48.google.com with SMTP id x12so134025wgg.19 for ; Mon, 07 Jul 2014 14:44:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Z2HRSALyGBDcJU0Uvitj/TLp2/pvickQkMWN/ALlYOs=; b=sJRaz/aKEDfX1lSselP1yScbBtZHzjU28qrheKPhrEHr7AfIZQe9Dw8IjhJabB3pPX ld2qyd5jdf6EffGovWXUvCDDR6elY4n4kytEwQ2c7VdQAZJ5LQJYTo1IxNk/0t5xZDSv V+gAh9tmYLcxvoEVd4vtfvTYpAKWz175Z7oYXJZp71kuGCMW/ELCdVVLLNC0ktqZ9jJn qUlIamgQHVRJfzXvlHdGGvxA37AKFyTOLXLxwWSw4+JN5PvVpLkkHV5rFc/u4aafFKxv VCdUzUA+Lcat0sVAm1MiLexs5ThJh2k6B1zW4Szoc12ssiKS8lrKMM+bSrRhqEMxZFXb ckVQ== X-Received: by 10.194.120.129 with SMTP id lc1mr35103410wjb.16.1404769481290; Mon, 07 Jul 2014 14:44:41 -0700 (PDT) Received: from gourin.bzh.lan (ks3095497.kimsufi.com. [94.23.60.27]) by mx.google.com with ESMTPSA id cj8sm91949118wjb.5.2014.07.07.14.44.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Jul 2014 14:44:40 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Mon, 7 Jul 2014 23:44:33 +0200 Message-Id: X-Mailer: git-send-email 1.9.1 In-Reply-To: References: Cc: "Yann E. MORIN" Subject: [Buildroot] [PATCH 2/6 v2] support/download: fix the git helper X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net 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" Reviewed-by: Arnout Vandecappelle (Essensium/Mind) --- support/download/git | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/support/download/git b/support/download/git index badb491..116e5a9 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