From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2/6 v2] support/download: fix the git helper
Date: Tue, 08 Jul 2014 18:45:56 +0200 [thread overview]
Message-ID: <53BC2044.1040409@mind.be> (raw)
In-Reply-To: <b0bdeb224c0dab926128a93fe7ddf31d4a3b67ac.1404769268.git.yann.morin.1998@free.fr>
On 07/07/14 23:44, Yann E. MORIN wrote:
> 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>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Actually, the ls-remote step is a bit useless: a failing shallow clone will not
be slower, and if it succeeds it wasn't necessary to begin with.
Regards,
Arnout
> ---
> 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
>
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
next prev parent reply other threads:[~2014-07-08 16:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-07 21:44 [Buildroot] [PATCH 0/6 v2] Cleanups in download helpers (branch yem/check-downloads) Yann E. MORIN
2014-07-07 21:44 ` [Buildroot] [PATCH 1/6 v2] support/download: fix the bzr helper Yann E. MORIN
2014-07-08 8:53 ` Peter Korsgaard
2014-07-07 21:44 ` [Buildroot] [PATCH 2/6 v2] support/download: fix the git helper Yann E. MORIN
2014-07-08 16:45 ` Arnout Vandecappelle [this message]
2014-07-08 21:39 ` Arnout Vandecappelle
2014-07-08 21:27 ` Peter Korsgaard
2014-07-07 21:44 ` [Buildroot] [PATCH 3/6 v2] support/download: properly use temp files Yann E. MORIN
2014-07-07 21:44 ` [Buildroot] [PATCH 4/6 v2] support/download: simplify the local-files helper Yann E. MORIN
2014-07-07 21:44 ` [Buildroot] [PATCH 5/6 v2] support/download: only create final temp file when needed Yann E. MORIN
2014-07-07 21:44 ` [Buildroot] [PATCH 6/6 v2] support/download: rationalise naming and use of the temporary files Yann E. MORIN
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53BC2044.1040409@mind.be \
--to=arnout@mind.be \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox