From: Fabio Fantoni Subject: Re: scripts/git-checkout.sh fails in some cases Date: Thu, 15 Oct 2015 16:28:37 +0200 Message-ID: <561FB815.2030703@m2r.biz> References: <561FACD4.3020401@m2r.biz> <20151015142253.GA32638@zion.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20151015142253.GA32638@zion.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu Cc: Ian Jackson , Ian Campbell , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org Il 15/10/2015 16:22, Wei Liu ha scritto: > On Thu, Oct 15, 2015 at 03:40:36PM +0200, Fabio Fantoni wrote: >> I already saw scripts/git-checkout.sh fails many times changing repo and/or >> tag for my tests, for example today: >>> GIT=git >>> /mnt/vm/source/xen/Xen/tools/firmware/../../scripts/git-checkout.sh >>> git://xenbits.xen.org/osstest/ovmf.git xen-tested-master ovmf-dir >>> Cloning into 'ovmf-dir-remote.tmp'... >>> remote: Counting objects: 203149, done. >>> remote: Compressing objects: 100% (49944/49944), done. >>> remote: Total 203149 (delta 153028), reused 196420 (delta 146807) >>> Ricezione degli oggetti: 100% (203149/203149), 194.95 MiB | 527.00 KiB/s, >>> done. >>> Risoluzione dei delta: 100% (153028/153028), done. >>> Checking connectivity... fatto. >>> warning: l'HEAD remoto si riferisce ad un ref inesistente, impossibile >>> eseguire il checkout. >>> fatal: Cannot update paths and switch to branch 'dummy' at the same time. >>> Did you intend to checkout 'xen-tested-master' which can not be resolved >>> as commit? >>> Makefile:23: set di istruzioni per l'obiettivo "ovmf-dir" non riuscito >>> make[3]: *** [ovmf-dir] Errore 128 >> I not understand why use a dummy branch even if directory is a "temp." >> I tried a very fast change and worked: >>> #!/bin/sh >>> >>> if test $# -lt 3; then >>> echo "Usage: $0 " >>> exit 1 >>> fi >>> >>> TREE=$1 >>> TAG=$2 >>> DIR=$3 >>> >>> set -e >>> >>> if test \! -d $DIR-remote; then >>> rm -rf $DIR-remote $DIR-remote.tmp >>> mkdir -p $DIR-remote.tmp; rmdir $DIR-remote.tmp >>> if test "$TAG" ; then >>> $GIT clone -b $TAG $TREE $DIR-remote.tmp >>> else >>> $GIT clone $TREE $DIR-remote.tmp >>> fi >>> mv $DIR-remote.tmp $DIR-remote >>> fi >>> rm -f $DIR >>> ln -sf $DIR-remote $DIR >> But probably a better improvement/solution is needed for a good script >> working with any branch (its head) or tag. >> >> Thanks for any reply and sorry for my bad english. > It's just because your local copy doesn't have xen-tested-master -- > there is no such local branch. > > We either put a commit id or tag in Config.mk. If you want to put a > branch in Config.mk in your case, use origin/xen-tested-master. > > I don't think it is a problem in git-checkout.sh because I don't think > we should make it "smart" enough to second guess what the user wants. > > Wei. Thanks for your reply, I'll try with origin next tests.