From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yann E. MORIN Date: Wed, 15 Jan 2014 00:21:26 +0100 Subject: [Buildroot] [PATCH 3/6] pkg-infra: git helper creates an empty archive if PKG_VERSION is a missing hash In-Reply-To: <52D5A17B.8010703@mind.be> References: <52D5A17B.8010703@mind.be> Message-ID: <20140114232126.GK3328@free.fr> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: buildroot@busybox.net Arnout, All, On 2014-01-14 21:43 +0100, Arnout Vandecappelle spake thusly: > On 13/01/14 00:44, Yann E. MORIN wrote: > >From: "Yann E. MORIN" [--SNIP--] > >-${GIT} archive --prefix="${prefix}" --format=tar "${cset}" \ > >-|gzip -c >"${output}" > >+res=1 > >+if ${GIT} rev-list -n 1 "${cset}" >/dev/null 2>&1; then > > When we've done a shallow clone, this check is redundant because we have > cloned exactly this ref. > > So instead, I'd do the check in the full clone condition, with an explicit > exit. I see. But it complexifies the script. And doing the check a second time ensures we did not download garbage Heck, there's even a race condition, since we check the remote, then clone it, and the ref may have vanished (granted, very unlikely, but yet...). :-p Regards, Yann E. MORIN. -- .-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'