Most of the t5551 http fetch tests use a handful of refs. But there are
a few test cases which check our handling of large numbers of refs.
These tests use the same server-side repo, so all subsequent tests end
up having to consider those extra refs, too.
The result is that the test script is a bit slower than it needs to be.
In a normal run, moving the "2,000 tags" test into its own repo drops my
runtime for the whole script from ~2.7s to ~1.9s.
This is a modest gain, but when we add the "--long" flag it gets much
bigger. There we trigger a test (marked with EXPENSIVE) that adds
100,000 tags, and the script runtime jumps to ~95s. But if we use the
same "many tags" repo for that, our runtime drops to just ~37s.
This is a pretty easy win to drop the cost of the script. It may even be
a larger gain on a heavily loaded system, since one of the main costs
here is unpacked refs, which are heavy on system time and I/O costs.
It's possible we are reducing test coverage, since all of those other
tests were inadvertently using large ref advertisements (and thus could
have uncovered some unexpected interaction). But that seems somewhat
unlikely; the tests targeted at the large number of refs are doing
roughly similar things to the other tests.
Note that the real performance culprit is the 100k-tag --long test, not
the 2k-tag one. So we could just let the 100k one use its own repo, and
keep the 2k tags in the main repo. But since these two tests are
somewhat interlinked, it's easier to just move them both (and it does
provide a small gain even for the 2000-tag test). I also notice that the
2000-tag test is gated on the CMDLINE_LIMIT prereq, and without that the
later EXPENSIVE test will fail (since we won't have a too-many-refs
clone). Nobody seems to have noticed or complained after many years, and
I left it alone for this patch.
Signed-off-by: Jeff King <peff@peff.net>
[jc: made the new "many-tags.git" bare to match the original "repo.git"]
Signed-off-by: Junio C Hamano <gitster@pobox.com>
}
test_expect_success 'create 2,000 tags in the repo' '
+ git init --bare "$HTTPD_DOCUMENT_ROOT_PATH/many-tags.git" &&
(
- cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
+ cd "$HTTPD_DOCUMENT_ROOT_PATH/many-tags.git" &&
create_tags 1 2000
)
'
test_expect_success CMDLINE_LIMIT \
'clone the 2,000 tag repo to check OS command line overflow' '
- run_with_limited_cmdline git clone $HTTPD_URL/smart/repo.git too-many-refs &&
+ run_with_limited_cmdline git clone $HTTPD_URL/smart/many-tags.git too-many-refs &&
(
cd too-many-refs &&
git for-each-ref refs/tags >actual &&
test_expect_success EXPENSIVE 'http can handle enormous ref negotiation' '
test_when_finished "rm -f tags" &&
(
- cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
+ cd "$HTTPD_DOCUMENT_ROOT_PATH/many-tags.git" &&
create_tags 2001 50000
) &&
git -C too-many-refs fetch -q --tags &&
(
- cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
+ cd "$HTTPD_DOCUMENT_ROOT_PATH/many-tags.git" &&
create_tags 50001 100000
) &&
git -C too-many-refs fetch -q --tags &&