Message ID | b0bdeb224c0dab926128a93fe7ddf31d4a3b67ac.1404769268.git.yann.morin.1998@free.fr |
---|---|
State | Accepted |
Commit | ebe6154ff4b2a7399f6d3b66dba01c71237cf133 |
Headers | show |
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 >
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes: > 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> Committed, thanks.
On 08/07/14 18:45, Arnout Vandecappelle wrote: > 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. d'Oh, silly me, that was introduced in d1f5fc29e in order to support pre-1.7.0 git versions that don't error out on a failing shallow clone. So it's not useless at all. Regards, Arnout
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
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> --- support/download/git | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)