Repository navigation
Add only-branches option to VCS repositories - #13086
Merged
Merged
Conversation
Repositories with many branches (e.g. symfony/symfony or shopware/shopware) are slow to load as the composer.json of every branch has to be read. The new only-branches option takes a list of branch names, supporting * wildcards, and skips all other branches before reading them. The default branch is always loaded. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Seldaek
force-pushed
the
vcs-only-branches
branch
from
October 21, 2026 20:57
93156c5 to
99a1af9
Compare
Member
|
Thanks |
|
I think this is missing an explicit test and documentation that an empty list is allowed, resulting in only the default branch to be allowed. If that is in fact not allowed, that would be a bug. |
Seldaek
added a commit
that referenced
this pull request
Oct 22, 2026
Member
|
@InvisibleSmiley fixed in c172206 |
gemmaro
pushed a commit
to phpusers-ja/composer
that referenced
this pull request
Nov 9, 2026
gemmaro
pushed a commit
to phpusers-ja/composer
that referenced
this pull request
Nov 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Repositories with a large number of branches are slow to load through a VCS repository, as the
composer.jsonof every single branch has to be read. For example shopware/shopware has 978 branches, while you usually only care about a handful of release branches.This adds an
only-branchesoption to VCS repositories. It takes a list of branch names, which can contain*wildcards, and skips all other branches before theircomposer.jsonis read. The default branch is always loaded, as it is read anyway to determine the package name and carries the default branch alias. Tags are not affected.Usage
{ "repositories": [ { "type": "vcs", "url": "https://github.com/symfony/symfony", "only-branches": ["7.4", "8.*"] } ] }With
-vvv, every skipped branch is reported asSkipped branch <name>, not matching the only-branches filter.The naming follows the existing
onlyoption, which filters by package name and is applied after the repository has been fully loaded, so it cannot avoid this cost.Performance
Loading shopware/shopware (978 branches) with the
gitdriver and a cold composer.json cache (cache-repo-dir). The git mirror was already cloned (35s) and shared between both runs, so only the reading of the branches and tags is measured."only-branches": ["6.6.x", "6.7.*"]The remaining time is mostly spent reading the tags, which are not filtered.
Changes
VcsRepository: filter branches aftergetBranches(), so this applies to all driverscomposer-schema.json: addonly-branchesto thevcs-repositorydefinition05-repositories.mdVcsRepositoryTest::testLoadVersionsWithOnlyBranchesFilter🤖 Generated with Claude Code