Re: [PATCH] t/perf: handle worktrees as test repos
- From
Jeff King <peff@peff.net>
- Date
- Feb 16, 2021, 22:56 UTC
- Message-ID
- <YCxNr+ViJsRlGbQJ@coredump.intra.peff.net>
- In-Reply-To
- <xmqqtuqbocae.fsf@gitster.c.googlers.com>
On Tue, Feb 16, 2021 at 02:52:57PM -0800, Junio C Hamano wrote:
Show 32 quoted lines
> Jeff King <peff@peff.net> writes:
>
> > 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?The main one IMHO is that HEAD would not be pointing where the user might expect it to be.
-Peff