Skip to contentSkip to conversation

scripts: Fix git-checkout.sh to work with branches other than master

PATCH In review Andrew Cooper 2 participants 2 messages Oct 30, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts: Fix git-checkout.sh to work with branches other than master

Xen uses master for QEMU_UPSTREAM_REVISION, and has done for other trees too in the path. Apparently we've never specified a different branch, because the git-clone rune only pulls in the master branch; it does not pull in diverging branches. Fix this by stating which branch/tag is wanted.

$TAG is really a committish, and git-clone's -b/--branch takes a committish too.

---
CC: Anthony PERARD <[email protected]>
CC: Juergen Gross <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>

Found while trying to test the MiniOS fixes in Gitlab. This is a example run with most stubdom builds passing:

https://gitlab.com/xen-project/people/andyhhp/xen/-/pipelines/1520611847

and all of them successfully cloned.

---
 scripts/git-checkout.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/git-checkout.sh +1 -1
index fd4425ac4ee8..3796cbfe39a7 100755
@@ -14,7 +14,7 @@ set -e
 if test \! -d $DIR-remote; then
 	rm -rf $DIR-remote $DIR-remote.tmp
 	mkdir -p $DIR-remote.tmp; rmdir $DIR-remote.tmp
-	$GIT clone $TREE $DIR-remote.tmp
+	$GIT clone -b $TAG $TREE $DIR-remote.tmp
 	if test "$TAG" ; then
 		cd $DIR-remote.tmp
 		$GIT branch -D dummy >/dev/null 2>&1 ||:

base-commit: bb7296d77f171c7bfbafab30ed51e9be29660e39

Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Andrew Cooper

Xen uses master for QEMU_UPSTREAM_REVISION, and has done for other trees too in the path. Apparently we've never specified a different branch, because the git-clone rune only pulls in the master branch; it does not pull in diverging branches. Fix this by stating which branch/tag is wanted.

$TAG is really a committish, and git-clone's -b/--branch takes a committish too.

Well spotted!

Quoted 35 lines

---
CC: Anthony PERARD <[email protected]>
CC: Juergen Gross <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>

Found while trying to test the MiniOS fixes in Gitlab. This is a example run with most stubdom builds passing:

https://gitlab.com/xen-project/people/andyhhp/xen/-/pipelines/1520611847

and all of them successfully cloned.

---
 scripts/git-checkout.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/git-checkout.sh +1 -1
index fd4425ac4ee8..3796cbfe39a7 100755
@@ -14,7 +14,7 @@ set -e
 if test \! -d $DIR-remote; then
 	rm -rf $DIR-remote $DIR-remote.tmp
 	mkdir -p $DIR-remote.tmp; rmdir $DIR-remote.tmp
-	$GIT clone $TREE $DIR-remote.tmp
+	$GIT clone -b $TAG $TREE $DIR-remote.tmp
 	if test "$TAG" ; then
 		cd $DIR-remote.tmp
 		$GIT branch -D dummy >/dev/null 2>&1 ||:

base-commit: bb7296d77f171c7bfbafab30ed51e9be29660e39

Signature · 1 line
2.39.5