[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] scripts: Refine git-checkout.sh change for different branches



On Thu Oct 31, 2024 at 1:47 PM GMT, Andrew Cooper wrote:
> The change works for divergent branches, but doesn't work for explicit SHAs.
>
> Instead of passing `-b $TAG` to clone, explicitly fetch the $TAG we want after
> cloning.
>
> Fixes: c554ec124b12 ("scripts: Fix git-checkout.sh to work with branches 
> other than master")
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> ---
> CC: Jan Beulich <JBeulich@xxxxxxxx>
> CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> CC: Julien Grall <julien@xxxxxxx>
>
> Speculative fix, pending CI:
>   https://gitlab.com/xen-project/people/andyhhp/xen/-/pipelines/1521847529
> ---
>  scripts/git-checkout.sh | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/git-checkout.sh b/scripts/git-checkout.sh
> index 3796cbfe39a7..9f8f2bd04fca 100755
> --- a/scripts/git-checkout.sh
> +++ b/scripts/git-checkout.sh
> @@ -14,9 +14,10 @@ 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 -b $TAG $TREE $DIR-remote.tmp
> +     $GIT clone $TREE $DIR-remote.tmp

Can this be shallow (--depth 1) clone instead to avoid pulling for whole
history in CI? There's probably some ENV variable that  could be recovered
from.

>       if test "$TAG" ; then
>               cd $DIR-remote.tmp
> +                $GIT fetch origin $TAG
>               $GIT branch -D dummy >/dev/null 2>&1 ||:
>               $GIT checkout -b dummy $TAG
>               cd -
>
> base-commit: 9a2a50d5de7647bfb529867fdce47ec64b07f06a
> prerequisite-patch-id: ef7a8f78a2a3bfb35a2835ce8c2ec97d95f1267e
> prerequisite-patch-id: 8c25962203bdb283a9c95328fb0867ffa3da8b95




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.