On Wed, May 19, 2021 at 09:13:27PM +0200, Patrick Steinhardt wrote: > We'll the connectivity check logic for git-receive-pack(1) in the > following commits to make it perform better. As a preparatory step, add > some benchmarks such that we can measure these changes. > > Signed-off-by: Patrick Steinhardt <ps@xxxxxx> > --- > t/perf/p5400-receive-pack.sh | 74 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 74 insertions(+) > create mode 100755 t/perf/p5400-receive-pack.sh > > diff --git a/t/perf/p5400-receive-pack.sh b/t/perf/p5400-receive-pack.sh > new file mode 100755 > index 0000000000..2b0c89d977 > --- /dev/null > +++ b/t/perf/p5400-receive-pack.sh > @@ -0,0 +1,74 @@ > +#!/bin/sh > + > +test_description="Tests performance of receive-pack" > + > +. ./perf-lib.sh > + > +test_perf_large_repo > + > +test_expect_success 'setup' ' > + # Create a main branch such that we do not have to rely on any specific > + # branch to exist in the perf repository. > + git switch --force-create main && > + > + TARGET_REPO_CLONE=$(pwd)/target-clone.git && > + git clone --bare --dissociate --branch main "$(pwd)" "$TARGET_REPO_CLONE" && > + TARGET_REPO_REFS=$(pwd)/target-refs.git && > + git clone --bare --dissociate --branch main "$(pwd)" "$TARGET_REPO_REFS" && > + TARGET_REPO_EMPTY=$(pwd)/target-empty.git && > + git init --bare "$TARGET_REPO_EMPTY" && > + > + # Set up a pre-receive hook such that no refs will ever be changed. > + # This easily allows multiple perf runs, but still exercises > + # server-side reference negotiation and checking for consistency. > + mkdir hooks && > + write_script hooks/pre-receive <<-EOF && > + #!/bin/sh Nit: the 'write_script' helper writes a shebang line, so this is unnecessary. > + echo "failed in pre-receive hook" > + exit 1 > + EOF