Skip to content

Fix: branch list empty#90

Open
Meldiron wants to merge 9 commits intomainfrom
fix-gitea-branch-list
Open

Fix: branch list empty#90
Meldiron wants to merge 9 commits intomainfrom
fix-gitea-branch-list

Conversation

@Meldiron
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor Author

@Meldiron Meldiron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 10, 2026

Greptile Summary

This PR fixes a Gitea edge case where an empty repository's /branches endpoint returns an empty HTTP body instead of [], causing a JSON parse exception. The fix passes decode: false to the HTTP client and manually calls json_decode(...) ?? [] to handle both valid empty JSON and an empty body gracefully. The PR also normalises pushed_at across Gitea, Gogs, and GitLab adapters (mapping updated_at/last_activity_at to that key for parity), fixes generateCloneCommand when $rootDirectory is empty, and refactors CI to run each adapter as an independent parallel matrix job.

Confidence Score: 5/5

Safe to merge — fix is targeted, well-tested, and all edge cases are handled correctly.

No P0/P1 issues found. The core fix is correct: decode:false + manual json_decode with null-coalescing fallback cleanly handles the empty-body edge case without breaking normal responses. The pushed_at normalization is consistent across all three adapters. CI restructuring is sound.

No files require special attention.

Important Files Changed

Filename Overview
src/VCS/Adapter/Git/Gitea.php Core bug fix: passes decode:false when fetching branches and manually handles empty-body edge case; also adds pushed_at normalization and fixes empty rootDirectory in generateCloneCommand
src/VCS/Adapter/Git/GitLab.php Maps last_activity_at to pushed_at in createRepository and getRepository for parity with other adapters
src/VCS/Adapter/Git/Gogs.php Mirrors Gitea's pushed_at normalization in createRepository and searchRepositories
tests/VCS/Base.php Adds testListBranchesEmptyRepo base test and pushed_at assertions; base test uses hardcoded 'test-kh' owner but all non-GitHub adapters override or skip it
phpunit.xml Splits test suites by adapter name to match CI matrix strategy
docker-compose.yml Assigns Docker Compose profiles to each service group and marks all test-container dependencies as required: false, enabling per-adapter profile selection

Reviews (3): Last reviewed commit: "Fix gitlab" | Re-trigger Greptile

@Meldiron Meldiron marked this pull request as draft April 10, 2026 14:28
Comment thread tests/VCS/Adapter/GitHubTest.php
@Meldiron Meldiron marked this pull request as ready for review April 22, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant