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

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


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Fri, 1 Nov 2024 08:26:08 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=citrix.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=99ZIF2UsAwjNyyyA85FKYo4ITFo/cSb3IKUIFn0qHxE=; b=dZaSdKOUZr03YaNPA5WA3sKHTlyFOVRKk3eMRACHh3i/wYnK2nNyZECB/RtV0Ha4OLccVScXyTgCXqrtIjcBSz4IFo3dtr3evT+OrL51+KjkwZA1tnrq3Nd4H9QCNstdp8Jo88ALkJ1I9loZIAfAjw/ZVgTQzTPUcVmo8fLuRN9ihA1pbxNEvsMwjgVa1ORili0Zvpg7caKv6Vk882+2yzH8VlNf1gWgYWNgnnGetoJdCrGnvMVWWGGDMn33jdQQy0uTviwQMD/tVnMTXnBCqMpw6tD0dcvMPI37xE6ihld+n+H3wx9IK/trgBE0EymK9si03bl13vW753yJg7L69Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=REOjUOVCWNOHYkAoreqQb6SzeL/NJwJG4vuUb0KmyzPcKz+wbXe8OhDz8vp6TMFhWaMYLUeJu4JXYW7B7dTgoyEGRNmr0EPOhLTEzru6DUM+6FdfGpUun2kH4BNt1FBMJvO+3Aku2qoP6r1XsLwoTWg8ZQr/IPjkfp0B0NXu4JATyTK0xij25OowzLAOgSvhgLDfBebXOIVCMTRHVG6lwWL3+ZsRz5wRy0FDbKqN/WTEPUryQDKa2xSre7AMIJRsNjVwNnC5Xu9A4JUwH6Z2j+iAH1hR6XKJYwcGyxa5Jp/5qfJSR9AwohmSu70ExEokJyyitYXG1D4d5QJjGcoqHA==
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>
  • Delivery-date: Fri, 01 Nov 2024 12:26:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2024-10-31 18:52, Andrew Cooper wrote:
On 31/10/2024 10:44 pm, Stefano Stabellini wrote:

On Thu, 31 Oct 2024, Andrew Cooper wrote:

On 31/10/2024 1:47 pm, 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
Nope.  While this works on staging, it breaks on 4.17

Back to the drawing board.
I am not certain about this but maybe we need:

   $GIT fetch origin

without the $TAG

You need the $TAG to guide what to pull when it's not a parent of master.

For real tags (which live in a global namespace), and real SHAs (don't
need any further reference), creating a branch called `dummy` from them
works fine.

The problem for branches is that $GIT fetch origin $TAG only updates
FETCH_HEAD and doesn't create a remote branch of the same name.  You can
do that with $GIT fetch origin $TAG:$TAG but only if you know that $TAG
is really a branch in the first place.

Which circles back around to the original problem of not being able to
disambiguate what $TAG is until you've got the whole repository.

I'm not aware of any way to ask the remote "do you know what type of
object $TAG actually is?" and that's probably because it would be a
reverse lookup through refs/ to figure out if it was a branch or not.

I'm sure there must be a way of doing this...

I'm not clear on the exact problem, but can you just checkout the FETCH_HEAD:

$GIT fetch origin $TAG
$GIT branch -D dummy >/dev/null 2>&1 ||:
$GIT checkout -b dummy FETCH_HEAD

?

Regards,
Jason



 


Rackspace

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