Hi, this is the sixth version of my patch series that tries to improve performance of the connectivity check by only considering preexisting refs as uninteresting that could actually have been advertised to the client. There are only two changes in this version compared to v5: - A fix to the test setup in commit 5/7 so that tests pass when GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main. - A typo fix in the commit message of patch 6/7. Patrick Patrick Steinhardt (7): refs: fix memory leak when parsing hideRefs config refs: get rid of global list of hidden refs revision: move together exclusion-related functions revision: introduce struct to handle exclusions revision: add new parameter to exclude hidden refs rev-parse: add `--exclude-hidden=` option receive-pack: only use visible refs for connectivity check Documentation/git-rev-parse.txt | 7 ++ Documentation/rev-list-options.txt | 7 ++ builtin/receive-pack.c | 10 +- builtin/rev-list.c | 1 + builtin/rev-parse.c | 18 +++- connected.c | 3 + connected.h | 7 ++ ls-refs.c | 13 ++- refs.c | 16 +-- refs.h | 5 +- revision.c | 131 +++++++++++++++-------- revision.h | 43 ++++++-- t/t6018-rev-list-glob.sh | 40 +++++++ t/t6021-rev-list-exclude-hidden.sh | 163 +++++++++++++++++++++++++++++ upload-pack.c | 30 +++--- 15 files changed, 411 insertions(+), 83 deletions(-) create mode 100755 t/t6021-rev-list-exclude-hidden.sh Range-diff against v5: 1: cfab8ba1a2 = 1: ef182e4330 refs: fix memory leak when parsing hideRefs config 2: d8118c6dd8 = 2: 48913c1493 refs: get rid of global list of hidden refs 3: 93a627fb7f = 3: 3827d6a2fc revision: move together exclusion-related functions 4: ad41ade332 = 4: 805de80e64 revision: introduce struct to handle exclusions 5: b5a4ce432a ! 5: d86a3342f6 revision: add new parameter to exclude hidden refs @@ t/t6021-rev-list-exclude-hidden.sh (new) +. ./test-lib.sh + +test_expect_success 'setup' ' -+ test_commit_bulk --id=commit --ref=refs/heads/main 1 && -+ COMMIT=$(git rev-parse refs/heads/main) && ++ test_commit_bulk --id=commit --ref=refs/heads/branch 1 && ++ COMMIT=$(git rev-parse refs/heads/branch) && + test_commit_bulk --id=tag --ref=refs/tags/lightweight 1 && + TAG=$(git rev-parse refs/tags/lightweight) && + test_commit_bulk --id=hidden --ref=refs/hidden/commit 1 && 6: 2eeb25eef0 ! 6: f8b5eb5a7e rev-parse: add `--exclude-hidden=` option @@ Commit message rev-parse: add `--exclude-hidden=` option Add a new `--exclude-hidden=` option that is similar to the one we just - added to git-rev-list(1). Given a seciton name `uploadpack` or `receive` + added to git-rev-list(1). Given a section name `uploadpack` or `receive` as argument, it causes us to exclude all references that would be hidden by the respective `$section.hideRefs` configuration. 7: f5f18f3939 = 7: a7eae80ff3 receive-pack: only use visible refs for connectivity check -- 2.38.1