Skip to contentSkip to conversation

scripts/git-checkout.sh fails in some cases

DISCUSSION Fabio Fantoni 2 participants 3 messages Oct 15, 2015

lore
Share & tools
lore
#0 lore raw

I already saw scripts/git-checkout.sh fails many times changing repo and/or tag for my tests, for example today:

Quoted 5 lines

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)

Quoted 8 lines

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:

Quoted 13 lines

#!/bin/sh

if test $# -lt 3; then

        echo "Usage: $0 <tree> <tag> <dir>"
        exit 1

fi

TREE=$1
TAG=$2
DIR=$3

set -e

Quoted 12 lines

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.

#1 lore raw
Quoted 49 lines · Fabio Fantoni

I already saw scripts/git-checkout.sh fails many times changing repo and/or tag for my tests, for example today:

Quoted 10 lines

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.

Quoted 8 lines

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:

Quoted 13 lines

#!/bin/sh

if test $# -lt 3; then

       echo "Usage: $0 <tree> <tag> <dir>"
       exit 1

fi

TREE=$1
TAG=$2
DIR=$3

set -e

Quoted 12 lines

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

Quoted 4 lines

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.

#2 lore raw

Il 15/10/2015 16:22, Wei Liu ha scritto:

Quoted 55 lines · Fabio Fantoni
Quoted 47 lines

I already saw scripts/git-checkout.sh fails many times changing repo and/or tag for my tests, for example today:

Quoted 10 lines

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.

Quoted 8 lines

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:

Quoted 13 lines

#!/bin/sh

if test $# -lt 3; then

        echo "Usage: $0 <tree> <tag> <dir>"
        exit 1

fi

TREE=$1
TAG=$2
DIR=$3

set -e

Quoted 12 lines

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

Quoted 4 lines

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.

Quoted 7 lines

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.