[PERFORMANCE] git check-attr on bare repo if supported

This commit is contained in:
oliverpool 2024-03-24 12:44:30 +01:00
parent d5a3f14063
commit 3c81f7478c
17 changed files with 450 additions and 386 deletions

View file

@ -400,16 +400,12 @@ func CreateOrUpdateFile(ctx context.Context, t *TemporaryUploadRepository, file
var lfsMetaObject *git_model.LFSMetaObject
if setting.LFS.StartServer && hasOldBranch {
// Check there is no way this can return multiple infos
filename2attribute2info, err := t.gitRepo.CheckAttribute(git.CheckAttributeOpts{
Attributes: []string{"filter"},
Filenames: []string{file.Options.treePath},
CachedOnly: true,
})
filterAttribute, err := t.gitRepo.GitAttributeFirst("", file.Options.treePath, "filter")
if err != nil {
return err
}
if filename2attribute2info[file.Options.treePath] != nil && filename2attribute2info[file.Options.treePath]["filter"] == "lfs" {
if filterAttribute == "lfs" {
// OK so we are supposed to LFS this data!
pointer, err := lfs.GeneratePointer(treeObjectContentReader)
if err != nil {