refactor!: remove go-git backend - #39487
silverwind wants to merge 4 commits into
Conversation
The gogit build tag was kept for Windows performance, but the git CLI backend is now at least as fast on Windows. go-git also keeps pack files open, so on Windows git's post-push repack leaves `.pack` files without their `.idx`, after which go-git fails every read of the repository with "packfile not found". Detect the object format through the cat-file process a request already uses instead of spawning `git hash-object` per repository, and stop running `--numstat` and an unused commit count for the activity page's top authors. Fixes: go-gitea#38359 Fixes: go-gitea#34694 Assisted-by: Claude Code:claude-opus-5-5
|
Looking into this "Small cold home" regression on Windows and Mac, all other benchmark cases are pure improvements. |
* origin/main: fix(actions): keep runs order after auto refresh (go-gitea#39479) ci: Also release for other versions than 1 majors (go-gitea#39475) docs: Add changelog for 28.0.0 (go-gitea#39474) [skip ci] Updated translations via Crowdin fix(git): reject fsck-invalid objects on push (go-gitea#39472) Assisted-by: Claude Code:claude-opus-5-5 # Conflicts: # modules/git/repo_base_gogit.go
wxiaoguang
left a comment
There was a problem hiding this comment.
No need to do that so fast. Wait for more user feedbacks.
There are far more important bugs and PRs need to handle.
go-git breaking repos sounds important enough and there's even two open issues about it. My initial trigger was go-git/go-git#2439, by the way which necessiated a ugly workaround. go-git is not a good library imho. |
As long as we won't provide gogit build, these issues are already "fixed". |
|
Its presence still affects development. I had to waste Claude tokens to produce that workaround for this shitty library which if it were gone would not have been needed. |
|
Sure. Just now you'll have to do it either way for a backport which will still have gogit. Why not wait some time so we can work on 28 and merge this later when it'll be mostly 29 work? |
|
As far as I understand, |
|
Most likely yes. Process isn't ironed out yet - we all know that.
I'll take it you'll make sure all the backports that touch git files which have gogit alternative will be fixed in gogit too? |
|
The Merging later in the release cycle will produce less conflict work, but ultimately I don't see conflicts as a problem, AI solves them flawlessly. I'm happy to resolve any that arise. |
|
It's not about conflicts.... Say you change a function after your PR that had gogit version. Now a backport would introduce drift between the two which either we'll forget about OR have to manually solve. |
|
Just wait for a few weeks, maybe to 28.2 (or 28.0.2) |
|
I don't see a big problem, but sure keep this open for a while and merge it once we are closer to v29. Just don't forget about it. |
golangci-lint does not read TAGS, the build tags come from --build-tags. Assisted-by: Claude Code:claude-opus-5-5
A cold directory listing walks history with git log and restarts it with a narrower pathspec whenever enough entries are resolved. On a small repository that is around ten git processes, which dominates the listing on Windows. A narrower pathspec only changes what git log lists where history is not a chain of commits with decreasing commit times. Restarts inside such a chain are now recorded instead of run, and the last recorded restart runs once the log leaves the chain, so the result stays identical. One rev-list call finds the chain. The walk also ignores log.follow now. It made git follow renames once a restart narrowed the pathspec to one path, and renamed entries lost their last commit. Assisted-by: Claude Code:claude-opus-5-5
|
Found some more optimizations and cold cache repo homepage got faster, table in #39487 is up to date. Many operations are now 2-3x faster than on main branch. If we want I could extract those perf tweaks from this PR and they could land independently. |
|
https://github.com/go-gitea/gitea/actions/runs/36721877142/job/109908823684 this flake is directly related to previously undiscivered go-git bugs exposed by #39426. It's not free keeping go-git in the tree. The sooner it's gone, the better. |
Next workaround for go-git in #39510, I'm getting tired of it already, would prefer we go ahead with the removal now and stop dealing with this crappy library. Forgejo removed it a long time ago. |
Removes the go-git backend so every build uses the git CLI backend. Its Windows performance advantage is gone, it lacks SHA-256 support, and it breaks repositories on Windows.
Bug: go-git keeps pack files open, so when git's auto-maintenance repacks after a push, which is the default since Git 2.54, Windows cannot delete the old
.packand go-git fails every read withpackfile not found.TAGS=gogitstill builds but has no effect.cat-fileinstead of spawninggit hash-objectper repository--numstatand an unusedrev-list --countfor activity top authorsgit logrestarts for cold directory listings while the history ahead is linear, fewer git processes for the same resultlog.followin that walk, it made renamed entries lose their last commitMedian ms from gogit to this PR, small is https://gitea.com/gitea/tea, large is this repository, Windows without Defender:
Fixes #38359
Fixes #34694