mirror of
https://github.com/go-gitea/gitea
synced 2025-07-05 18:17:19 +00:00
Lazy load object format with command line and don't do it in OpenRepository (#29712)
Most time, when invoking `git.OpenRepository`, `objectFormat` will not be used, so it's a waste to invoke commandline to get the object format. This PR make it a lazy operation, only invoke that when necessary.
This commit is contained in:
@ -246,7 +246,12 @@ func (repo *Repository) CommitsByFileAndRange(opts CommitsByFileAndRangeOptions)
|
||||
}
|
||||
}()
|
||||
|
||||
len := repo.objectFormat.FullLength()
|
||||
objectFormat, err := repo.GetObjectFormat()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
len := objectFormat.FullLength()
|
||||
commits := []*Commit{}
|
||||
shaline := make([]byte, len+1)
|
||||
for {
|
||||
|
Reference in New Issue
Block a user