From patchwork Tue Apr 17 16:48:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 899454 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=free.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="tvaAhsYi"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40QWRD19Fsz9s1d for ; Wed, 18 Apr 2018 02:48:40 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 8009787A68; Tue, 17 Apr 2018 16:48:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tz4scULqC3UL; Tue, 17 Apr 2018 16:48:37 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 2F66187A72; Tue, 17 Apr 2018 16:48:37 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 96B6E1C2635 for ; Tue, 17 Apr 2018 16:48:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 939C386E90 for ; Tue, 17 Apr 2018 16:48:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TZR8vB1_PFW2 for ; Tue, 17 Apr 2018 16:48:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by fraxinus.osuosl.org (Postfix) with ESMTPS id B564686E88 for ; Tue, 17 Apr 2018 16:48:30 +0000 (UTC) Received: by mail-wr0-f195.google.com with SMTP id s18so37375612wrg.9 for ; Tue, 17 Apr 2018 09:48:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=teQK7N6HMUq6fK9wgqDSdILEpvTrFsxUMcuy959ZQU0=; b=tvaAhsYiuYoq3FLO/9ZH88prbEIoW0EtBQCIsDF662T5jctpibbRwf8BHFGZT0scfB 4wuy3hu9aCYDuF7aN3HOG/Hx8hfmXkXE/ITpo93PYquYD4mKDVqPbjvH6fKCMvP9L4IR Lfm8DRahlJMGxZDZf4RIbTcliUs8yYk6gZL40VyIG+FRKNsq1uqMcUruy/4ykFJS7J+s R6YTHb/qLstIZqR2vY7Za7pVVNhBGvkIHWTdw72FnB9BfqqMxiQzfmrwbyexIiCeHsxx +RD7L4/Y7YTtagegxZc49+i/HIoAqBmtSJXL8zCoXUEEkbVjSZxT/TFpeJcU+aL2UaF0 TeTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=teQK7N6HMUq6fK9wgqDSdILEpvTrFsxUMcuy959ZQU0=; b=JQqDBo/oUc/yr0vuOzC65Baq0sApQDp7VshLs4GMXsNjSy6O0XzsyVUr/KuPw0O55I 8tjcyWtcAyPSuk+3t1Us9gwO20Ui/nbdjc5ag0tbkTox7Jt7fqI9ANRH5HsrqIzo5pPQ KoUA9XcOYgGY0KB2YKMJJsJabydhW7b0SrGLqBApjXJDEmHYYcqdvUyZSIPhxWRFgk8p EnZYcAezcVAJTnqka5Mn462H8aNtIX82vMyBTQFhgXtijXc5EEIJVbmrq73IGINw2zD+ 0NESFCs0GtwvP2wXbYHLDyMsb19pHnthUHENvlc7Ep0tIq1SwjeGbgQVDuvCOJiynPdz hvEw== X-Gm-Message-State: ALQs6tCQ27CWcbgqChq5hgvaf8mwzAKrJzOC/AlA9vuKewIhYPNU9fKK 7hFKBT/xGGj+QTBfDi/Eg99cRA== X-Google-Smtp-Source: AIpwx49kfDbpkq8l0aCMETv6YPy56D92PRBQY4YpPjymyzJrV+qwsKsD9dTQVR2tf/VMXEvZpRVLbA== X-Received: by 10.28.1.131 with SMTP id 125mr1460688wmb.96.1523983709033; Tue, 17 Apr 2018 09:48:29 -0700 (PDT) Received: from scaer.bzh.lan (2a01cb0886107300a556795e0851f8aa.ipv6.abo.wanadoo.fr. [2a01:cb08:8610:7300:a556:795e:851:f8aa]) by smtp.gmail.com with ESMTPSA id e13sm24535952wrg.79.2018.04.17.09.48.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Apr 2018 09:48:28 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Tue, 17 Apr 2018 18:48:23 +0200 Message-Id: <62d815cfe104e4d172ca4d51e1d56e577f737b87.1523983687.git.yann.morin.1998@free.fr> X-Mailer: git-send-email 2.14.1 In-Reply-To: References: Subject: [Buildroot] [PATCH 4/4] download/git: always do full-clone X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Yann E. MORIN" , Ricardo Martincoski MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" We currently attempt a shallow clone, as tentative to save bandwidth and download time. However, now that we keep the git tree as a cache, it may happen that we need to checkout an earlier commit, and that would not be present with a shallow clone. Furthermore, the shallow fetch is already really btroken, and just happens by chance. Consider the following actions, which are basivcally what happens today: mkdir git git init git cd git git remote add origin https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch origin --depth 1 v4.17-rc1 if ! git fetch origin v4.17-rc1:v4.17-rc1 ; then echo "warning" fi git checkout v4.17-rc1 The checkout succeeds just because of the git-fetch in the if-condition, which is initially there to fetch the special refs from github MRs, or gerrit reviews. That fails, but we jsut print a warning. If we were to ever remove support for special refs, then the checkout would fail. The whole purpose of the git cache is to actually save bandwith and download time, but in the long run. For one-offs, people would preferably use a wget download (e.g. with the github macro) instead of a git clone. We switch to always doing a full clone. It is nore correct, and pays off in the long run... Signed-off-by: "Yann E. MORIN" Cc: Ricardo Martincoski --- support/download/git | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/support/download/git b/support/download/git index e71ff029cd..6a4d1f937b 100755 --- a/support/download/git +++ b/support/download/git @@ -63,26 +63,9 @@ fi _git remote set-url origin "'${uri}'" -# Try to fetch with limited depth, since it is faster than a full clone - but -# that only works if the version is a ref (tag or branch). Before trying to do -# a shallow clone we check if ${cset} is in the list provided by git ls-remote. -# If not we fallback to a full fetch. -# -# Messages for the type of clone used are provided to ease debugging in -# case of problems -git_done=0 -if [ -n "$(_git ls-remote origin "'${cset}'" 2>&1)" ]; then - printf "Doing a shallow fetch\n" - if _git fetch "${@}" --depth 1 origin "'${cset}'"; then - git_done=1 - else - printf "Shallow fetch failed, falling back to fetching all refs\n" - fi -fi -if [ ${git_done} -eq 0 ]; then - printf "Fetching all references\n" - _git fetch origin -t -fi +printf "Fetching all references\n" +_git fetch origin +_git fetch origin -t # Try to get the special refs exposed by some forges (pull-requests for # github, changes for gerrit...). There is no easy way to know whether