diff mbox series

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

Message ID 20241030194438.2733973-1-andrew.cooper3@citrix.com (mailing list archive)
State New
Headers show
Series scripts: Fix git-checkout.sh to work with branches other than master | expand

Commit Message

Andrew Cooper Oct. 30, 2024, 7:44 p.m. UTC
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.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Anthony PERARD <anthony.perard@vates.tech>
CC: Juergen Gross <jgross@suse.com>
CC: Jan Beulich <JBeulich@suse.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien@xen.org>

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(-)


base-commit: bb7296d77f171c7bfbafab30ed51e9be29660e39

Comments

Stefano Stabellini Oct. 30, 2024, 9:19 p.m. UTC | #1
On Wed, 30 Oct 2024, Andrew Cooper wrote:
> 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.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Well spotted!

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
> CC: Anthony PERARD <anthony.perard@vates.tech>
> CC: Juergen Gross <jgross@suse.com>
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Julien Grall <julien@xen.org>
> 
> 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(-)
> 
> diff --git a/scripts/git-checkout.sh b/scripts/git-checkout.sh
> index fd4425ac4ee8..3796cbfe39a7 100755
> --- a/scripts/git-checkout.sh
> +++ b/scripts/git-checkout.sh
> @@ -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
> -- 
> 2.39.5
>
diff mbox series

Patch

diff --git a/scripts/git-checkout.sh b/scripts/git-checkout.sh
index fd4425ac4ee8..3796cbfe39a7 100755
--- a/scripts/git-checkout.sh
+++ b/scripts/git-checkout.sh
@@ -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 ||: