git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Philippe Blain via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Victoria Dye <vdye@github.com>,
	Neeraj Singh <neerajsi@microsoft.com>,
	Philippe Blain <levraiphilippeblain@gmail.com>
Subject: Re: [PATCH 2/2] p9210: fix 'scalar clone' when running from a detached HEAD
Date: Mon, 31 Mar 2025 09:27:21 +0200	[thread overview]
Message-ID: <Z-pD2aeCJ6yp9XBN@pks.im> (raw)
In-Reply-To: <1092c32609f249839453052ca802cb10256cb48f.1743181669.git.gitgitgadget@gmail.com>

On Fri, Mar 28, 2025 at 05:07:49PM +0000, Philippe Blain via GitGitGadget wrote:
> From: Philippe Blain <levraiphilippeblain@gmail.com>
> 
> In p9210-scalar-clone.sh, we test using 'scalar clone' to clone
> $GIT_PERF_LARGE_REPO (copied locally as 'to-clone'), which defaults to
> the git.git checkout we are running the test from.
> 
> When --branch is not specified (as in this test), 'scalar clone' tries
> to get the default branch of the remote repository by parsing the output
> of 'git ls-remote --symref $URL HEAD', as implemented in
> scalar.c:remote_default_branch. When the git.git checkout we are running
> the test from is in detached HEAD, this fails and we fall back to using
> the name of the currently checked out branch in the newly initialized
> repository, which in this case is the value returned earlier in
> cmd_clone by repo_default_branch_name.
> 
> We then invoke 'git checkout -t origin/$branch', with $branch being the
> name we got from remote_default_branch. This invocation fails if
> '$branch' does not exist as a branch in the current git.git checkout.
> 
> Fix this by creating a local branch in 'to-clone' in the setup test
> "enable server-side partial clone", making sure to use '-B' in case a
> branch named 'test-branch' already exists.
> 
> Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
> ---
>  t/perf/p9210-scalar.sh | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/t/perf/p9210-scalar.sh b/t/perf/p9210-scalar.sh
> index 265f7cd1fe2..56b075e906e 100755
> --- a/t/perf/p9210-scalar.sh
> +++ b/t/perf/p9210-scalar.sh
> @@ -7,7 +7,8 @@ test_perf_large_repo "$TRASH_DIRECTORY/to-clone"
>  
>  test_expect_success 'enable server-side partial clone' '
>  	git -C to-clone config uploadpack.allowFilter true &&
> -	git -C to-clone config uploadpack.allowAnySHA1InWant true
> +	git -C to-clone config uploadpack.allowAnySHA1InWant true &&
> +	git -C to-clone checkout -B test-branch
>  '

This feels like an easy and pragmatic fix. Thanks!

Patrick

  reply	other threads:[~2025-03-31  7:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-28 17:07 [PATCH 0/2] Two perf test fixes Philippe Blain via GitGitGadget
2025-03-28 17:07 ` [PATCH 1/2] p7821: fix test_perf invocation for prereqs Philippe Blain via GitGitGadget
2025-03-31  7:27   ` Patrick Steinhardt
2025-04-13 19:00     ` Philippe Blain
2025-03-28 17:07 ` [PATCH 2/2] p9210: fix 'scalar clone' when running from a detached HEAD Philippe Blain via GitGitGadget
2025-03-31  7:27   ` Patrick Steinhardt [this message]
2025-04-12 18:15 ` [PATCH v2 0/3] Two perf test fixes Philippe Blain via GitGitGadget
2025-04-12 18:15   ` [PATCH v2 1/3] p7821: fix test_perf invocation for prereqs Philippe Blain via GitGitGadget
2025-04-12 18:15   ` [PATCH v2 2/3] p9210: fix 'scalar clone' when running from a detached HEAD Philippe Blain via GitGitGadget
2025-04-12 18:15   ` [PATCH v2 3/3] p7821: fix instructions for testing with threads Philippe Blain via GitGitGadget
2025-04-14 21:48     ` Junio C Hamano
2025-04-13  2:50   ` [PATCH v2 0/3] Two perf test fixes Philippe Blain
2025-04-14 16:04     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z-pD2aeCJ6yp9XBN@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=levraiphilippeblain@gmail.com \
    --cc=neerajsi@microsoft.com \
    --cc=vdye@github.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).