refactor!: remove go-git backend (#39487)

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.

The performance changes moved to
https://github.com/go-gitea/gitea/pull/39526.

Fixes https://github.com/go-gitea/gitea/issues/38359
Fixes https://github.com/go-gitea/gitea/issues/34694

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
silverwind
2026-10-03 12:04:24 +02:00
committed by GitHub
parent 3932624947
commit ad38b60983
69 changed files with 995 additions and 2741 deletions
+36
View File
@@ -10,6 +10,7 @@ import (
"slices"
"strings"
"gitea.dev/modules/log"
"gitea.dev/modules/util"
)
@@ -169,3 +170,38 @@ func (tes Entries) CustomSort(cmp func(s1, s2 string) int) {
return cmp(a.Name(), b.Name())
})
}
func (te *TreeEntry) GetSize(ctx context.Context, gitRepo *Repository) int64 {
if te.IsDir() {
return 0
} else if te.sized {
return te.size
}
batch, cancel, err := gitRepo.CatFileBatch()
if err != nil {
log.Debug("error whilst reading size for %s in %s. Error: %v", te.ID.String(), gitRepo.LogString(), err)
return 0
}
defer cancel()
info, err := batch.QueryInfo(te.ID.String())
if err != nil {
log.Debug("error whilst reading size for %s in %s. Error: %v", te.ID.String(), gitRepo.LogString(), err)
return 0
}
te.size = info.Size
te.sized = true
return te.size
}
// Blob returns the blob object the entry
func (te *TreeEntry) Blob(gitRepo *Repository) *Blob {
return &Blob{
ID: te.ID,
name: te.Name(),
size: te.size,
gotSize: te.sized,
repo: gitRepo,
}
}