From: Benjamin Kamath <kamath.ben@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v3] support/download/git: Prioritize remote archive
Date: Wed, 24 Aug 2016 10:47:28 -0700 [thread overview]
Message-ID: <1472060848-14178-1-git-send-email-kamath.ben@gmail.com> (raw)
In-Reply-To: <1471469135-19009-1-git-send-email-kamath.ben@gmail.com>
Attempt to do a remote archive since it shortcuts us past a few steps when
available. Additionally. if the git server has uploadArchive.allowUnreachable
set to true, then this method can also work on arbitrary sha1s, offering a huge
speed advantage over a full clone.
Signed-off-by: Benjamin Kamath <kamath.ben@gmail.com>
---
Changes v2 -> v3:
- Indicate to user if the remote archive fails (suggested by Yann)
- redirect all errors from git archive to /dev/null since this
operation fails on most public git servers
Changes v1 -> v2:
- Skip remote archive for repositories with submodules (suggested by Yann)
support/download/git | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/support/download/git b/support/download/git
index 416cd1b..ec49057 100755
--- a/support/download/git
+++ b/support/download/git
@@ -36,6 +36,22 @@ _git() {
eval ${GIT} "${@}"
}
+# Try a remote archive, since it is as fast as a shallow clone and can give us
+# an archive directly. Also, if uploadArchive.allowUnreachable is set to true
+# on the remote, this will also work for arbitrary sha1s, and will offer a
+# considerable speedup over a full clone. This will not work for submodules.
+# Since this command fails on most public git servers, consign the output to
+# oblivion but still trace as a warning.
+if [ ${recurse} -eq 0 ]; then
+ printf "Doing remote archive\n"
+ if _git archive --format=tar.gz --prefix=${basename}/ --remote=${repo} \
+ -o ${output} ${cset} >/dev/null 2>&1; then
+ exit 0
+ else
+ printf "Remote archive failed, falling back to cloning\n"
+ fi
+fi
+
# Try a shallow clone, 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
--
2.7.4
next prev parent reply other threads:[~2016-08-24 17:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-17 21:25 [Buildroot] [PATCH v2] support/download/git: Prioritize remote archive Benjamin Kamath
2016-08-17 21:53 ` Yann E. MORIN
2016-08-17 22:17 ` Benjamin Kamath
2016-08-18 9:10 ` Yann E. MORIN
2016-08-18 9:26 ` Benjamin Kamath
2016-08-18 9:33 ` Yann E. MORIN
2016-08-18 17:09 ` Yann E. MORIN
2016-08-24 17:47 ` Benjamin Kamath [this message]
2017-02-12 22:01 ` [Buildroot] [PATCH v3] " Arnout Vandecappelle
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=1472060848-14178-1-git-send-email-kamath.ben@gmail.com \
--to=kamath.ben@gmail.com \
--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