git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t/perf: handle worktrees as test repos

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 16, 2021, 22:52 UTC
Message-ID
<xmqqtuqbocae.fsf@gitster.c.googlers.com>
In-Reply-To
<YCwoOMo7obrNOGYX@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 25 quoted lines
> On Tue, Feb 16, 2021 at 03:12:45PM -0500, Jeff King wrote:
>
>> Having written that, it occurs to me that an even simpler solution is to
>> just always use the commondir as the source of the scratch repo. It does
>> not produce the same outcome, but the point is generally just to find a
>> suitable starting point for a repository. Grabbing the main repo instead
>> of one of its worktrees is probably OK for most tests.
>
> The patch there is delightfully simple:
>
> diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
> index e385c6896f..7018256cd4 100644
> --- a/t/perf/perf-lib.sh
> +++ b/t/perf/perf-lib.sh
> @@ -75,7 +75,7 @@ test_perf_create_repo_from () {
>  	BUG "not 2 parameters to test-create-repo"
>  	repo="$1"
>  	source="$2"
> -	source_git="$("$MODERN_GIT" -C "$source" rev-parse --git-dir)"
> +	source_git="$("$MODERN_GIT" -C "$source" rev-parse --git-common-dir)"
>  	objects_dir="$("$MODERN_GIT" -C "$source" rev-parse --git-path objects)"
>  	mkdir -p "$repo/.git"
>  	(
>
> but I do wonder if somebody would find it confusing.
That does look quite a lot simpler.

What are the possible downsides? Per-worktree references may not be pointing at the same objects?

Previous: Derrick StoleeNext: Jeff King
Message 4 of 12 in “t/perf: handle worktrees as test repos”
  1. t/perf: handle worktrees as test reposJeff King, Feb 16, 2021
  2. Jeff KingFeb 16, 2021
  3. Derrick StoleeFeb 16, 2021
  4. Junio C HamanoFeb 16, 2021
  5. Jeff KingFeb 16, 2021
  6. Johannes SchindelinFeb 16, 2021
  7. Jeff KingFeb 16, 2021
  8. t/perf worktree improvementsJeff King, Feb 26, 2021
  9. 1/2 t/perf: handle worktrees as test reposJeff King, Feb 26, 2021
  10. 2/2 t/perf: avoid copying worktree files from test repoJeff King, Feb 26, 2021
  11. Derrick StoleeFeb 26, 2021
  12. Johannes SchindelinMar 1, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.