fix(repo): avoid a repo-sized temp file for every bundle download - #38863
Merged
Merged
Conversation
Assisted-by: Claude Code:claude-opus-5
somaz94
marked this pull request as ready for review
August 11, 2026 06:54
wxiaoguang
reviewed
Aug 11, 2026
silverwind
approved these changes
Aug 11, 2026
This comment was marked as outdated.
This comment was marked as outdated.
wxiaoguang
marked this pull request as draft
August 11, 2026 14:18
A refs/heads/* ref alone is not enough. Without a HEAD at the same commit, a clone of the bundle gets no branch and no checkout, on git 2.13 through 2.55. The live repo cannot supply that HEAD, because its own HEAD points at the default branch, so the temp repo has to stay. Assisted-by: Claude Code:claude-opus-5
wxiaoguang
marked this pull request as ready for review
August 11, 2026 15:02
bircni
enabled auto-merge (squash)
August 11, 2026 16:02
bircni
approved these changes
Aug 11, 2026
silverwind
added a commit
to ToastyTheBot/gitea
that referenced
this pull request
Aug 11, 2026
* origin/main: (22 commits) fix(repo): avoid a repo-sized temp file for every bundle download (go-gitea#38863) refactor: markup render (go-gitea#38864) fix(lfs): accept successful transfer responses (go-gitea#38866) chore: bump pnpm to v11 in nix flake (go-gitea#38856) refactor: api token scope check (go-gitea#38862) [skip ci] Updated translations via Crowdin fix(avatar): use sha256 and inline the federated avatar lookup (go-gitea#38843) enhance(actions): set ref_protected in context (go-gitea#38852) chore(deps): update dependencies (go-gitea#38851) chore: drop `make update*` targets (go-gitea#38845) refactor: form binding validation (go-gitea#38832) [skip ci] Updated translations via Crowdin enhance(ui): restyle toasts (go-gitea#38842) feat(packages): add support for uploading helm provenance files (go-gitea#36695) chore: rename migration package for next release to v28 (go-gitea#38844) refactor: replace `gliderlabs/ssh` with `golang.org/x/crypto/ssh` (go-gitea#38837) fix(gitdiff): render exact-limit diffs and zero-limit comments (go-gitea#38838) enhance: refine repo watching (go-gitea#38835) chore: enable `forcetypeassert` linter, fix issues (go-gitea#38804) ci: install tools for renovate post-upgrade tasks (go-gitea#38815) ... # Conflicts: # modelmigration/migrations.go # modelmigration/v28/v348.go # modelmigration/v28/v348_test.go # routers/web/repo/setting/deploy_key.go # routers/web/repo/setting/settings_test.go
zjjhot
added a commit
to zjjhot/gitea
that referenced
this pull request
Aug 12, 2026
* 'main' of https://github.com/go-gitea/gitea: (43 commits) [skip ci] Updated translations via Crowdin fix(repo): avoid a repo-sized temp file for every bundle download (go-gitea#38863) refactor: markup render (go-gitea#38864) fix(lfs): accept successful transfer responses (go-gitea#38866) chore: bump pnpm to v11 in nix flake (go-gitea#38856) refactor: api token scope check (go-gitea#38862) [skip ci] Updated translations via Crowdin fix(avatar): use sha256 and inline the federated avatar lookup (go-gitea#38843) enhance(actions): set ref_protected in context (go-gitea#38852) chore(deps): update dependencies (go-gitea#38851) chore: drop `make update*` targets (go-gitea#38845) refactor: form binding validation (go-gitea#38832) [skip ci] Updated translations via Crowdin enhance(ui): restyle toasts (go-gitea#38842) feat(packages): add support for uploading helm provenance files (go-gitea#36695) chore: rename migration package for next release to v28 (go-gitea#38844) refactor: replace `gliderlabs/ssh` with `golang.org/x/crypto/ssh` (go-gitea#38837) fix(gitdiff): render exact-limit diffs and zero-limit comments (go-gitea#38838) enhance: refine repo watching (go-gitea#38835) chore: enable `forcetypeassert` linter, fix issues (go-gitea#38804) ...
zjjhot
added a commit
to zjjhot/gitea
that referenced
this pull request
Aug 12, 2026
* main: (43 commits) [skip ci] Updated translations via Crowdin fix(repo): avoid a repo-sized temp file for every bundle download (go-gitea#38863) refactor: markup render (go-gitea#38864) fix(lfs): accept successful transfer responses (go-gitea#38866) chore: bump pnpm to v11 in nix flake (go-gitea#38856) refactor: api token scope check (go-gitea#38862) [skip ci] Updated translations via Crowdin fix(avatar): use sha256 and inline the federated avatar lookup (go-gitea#38843) enhance(actions): set ref_protected in context (go-gitea#38852) chore(deps): update dependencies (go-gitea#38851) chore: drop `make update*` targets (go-gitea#38845) refactor: form binding validation (go-gitea#38832) [skip ci] Updated translations via Crowdin enhance(ui): restyle toasts (go-gitea#38842) feat(packages): add support for uploading helm provenance files (go-gitea#36695) chore: rename migration package for next release to v28 (go-gitea#38844) refactor: replace `gliderlabs/ssh` with `golang.org/x/crypto/ssh` (go-gitea#38837) fix(gitdiff): render exact-limit diffs and zero-limit comments (go-gitea#38838) enhance: refine repo watching (go-gitea#38835) chore: enable `forcetypeassert` linter, fix issues (go-gitea#38804) ...
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.
Bundle downloads run
git bundle createinto a temp file underdata/tmp/git-repo-contentand copy it to the response, so every download puts a second, repo-sized copy on disk before the first byte is sent. If the process dies mid-request that copy is stranded: the startup sweep only drops files older than 3 days, and cannot remove a directory that still holds a newer file.Streaming
git bundle create -to the response removes that copy.CreateArchiveabove already uses the same gitcmd pattern, and the bundle bytes are unchanged (existing integration assertions on the exact length still pass).One consequence: git can now fail after output starts, so a mid-stream failure truncates the body instead of returning an error.
I did not act on the TODO. A temp ref only works under
refs/heads/*; withrefs/bundle/temp-*the bundle carries no branch and clones empty, so I noted that on the TODO.Fixes #38447
Assisted-by: Claude Code:claude-opus-5