You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR fixes an edge case where Gitea returns an empty response body (instead of []) for the branches endpoint on a newly-created empty repository, causing listBranches to misbehave. The fix uses decode: false on the raw HTTP call and manually JSON-decodes the body. The PR also refactors CI to use a per-adapter matrix strategy with Docker Compose profiles, adds a pushed_at field to GitLab/Gitea repository responses, and adds a testListBranchesEmptyRepo regression test to the shared base.
GitLabTest.php is missing a markTestSkipped override for the new testListBranchesEmptyRepo — without it, the inherited base test will call listBranches (which throws Exception(\"Not implemented\")) and use the hardcoded 'test-kh' owner that doesn't exist in the GitLab test environment, breaking the gitlab test suite.
Confidence Score: 4/5
Safe to merge after adding the missing testListBranchesEmptyRepo skip override in GitLabTest.php.
The core listBranches fix is correct and well-tested. One P1 issue exists: the new base test will cause the GitLab PHPUnit suite to fail because the skip override was not added alongside the existing testListBranches skip. All other changes (CI matrix, docker-compose profiles, pushed_at normalization) look correct.
tests/VCS/Adapter/GitLabTest.php — needs a testListBranchesEmptyRepo override with markTestSkipped.
Important Files Changed
Filename
Overview
src/VCS/Adapter/Git/Gitea.php
Core fix: listBranches now calls with decode: false and manually JSON-decodes the body, handling Gitea's edge case of returning an empty body (instead of []) for repos with no branches. One leftover commented-out line in createRepository.
tests/VCS/Adapter/GitLabTest.php
Missing testListBranchesEmptyRepo skip override — the new Base test will run against GitLab, fail on the hardcoded 'test-kh' owner and the unimplemented listBranches, breaking the gitlab test suite.
tests/VCS/Base.php
Added testListBranchesEmptyRepo covering the empty-repo branch-list edge case, plus pushed_at assertions in repository tests; logic is correct for Gitea/Forgejo/Gogs adapters.
src/VCS/Adapter/Git/GitLab.php
Added pushed_at normalization in createRepository and getRepository by mapping last_activity_at; no issues found.
.github/workflows/tests.yml
Switched to a fail-fast: false matrix strategy per adapter, scoping both Docker Compose profiles and PHPUnit test suites correctly.
docker-compose.yml
Migrated service conditions from service_healthy to service_started with required: false, enabling profile-scoped startup so only the adapter under test is brought up.
tests/VCS/Adapter/GitHubTest.php
Correctly skips testListBranchesEmptyRepo since GitHub always initialises a default branch on repo creation.
tests/VCS/Adapter/GiteaTest.php
Added pushed_at assertions to repository tests; inherits testListBranchesEmptyRepo from Base correctly.
phpunit.xml
Defines named test suites per adapter, enabling --testsuite <adapter> CLI usage in CI.
CONTRIBUTING.md
Documents the per-adapter test workflow clearly.
Comments Outside Diff (1)
tests/VCS/Adapter/GitLabTest.php, line 209-212 (link)
Missing testListBranchesEmptyRepo override
Base::testListBranchesEmptyRepo was added in this PR but GitLabTest only skips testListBranches. Without a matching skip override, the inherited test will call createRepository('test-kh', …) (a hardcoded owner that doesn't exist in the GitLab environment) and then listBranches, which throws Exception("Not implemented"), causing the GitLab test suite to fail.
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
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.
No description provided.