aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2024-02-24 14:55:19 +0800
committerGitHub <noreply@github.com>2024-02-24 06:55:19 +0000
commitb79c30435f439af8243ee281310258cdf141e27b (patch)
tree43ffc1c750b427434e52880e8969dffc6aaaed33 /routers/api
parent4ba642d07d50d7eb42ae33cd6f1f7f2c82c02a40 (diff)
downloadgitea-b79c30435f439af8243ee281310258cdf141e27b.tar.gz
gitea-b79c30435f439af8243ee281310258cdf141e27b.zip
Use the database object format name but not read from git repoisitory everytime and fix possible migration wrong objectformat when migrating a sha256 repository (#29294)
Now we can get object format name from git command line or from the database repository table. Assume the column is right, we don't need to read from git command line every time. This also fixed a possible bug that the object format is wrong when migrating a sha256 repository from external. <img width="658" alt="image" src="https://github.com/go-gitea/gitea/assets/81045/6e9a9dcf-13bf-4267-928b-6bf2c2560423">
Diffstat (limited to 'routers/api')
-rw-r--r--routers/api/v1/utils/git.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/api/v1/utils/git.go b/routers/api/v1/utils/git.go
index 2299cdc247..5e80190017 100644
--- a/routers/api/v1/utils/git.go
+++ b/routers/api/v1/utils/git.go
@@ -72,7 +72,7 @@ func searchRefCommitByType(ctx *context.APIContext, refType, filter string) (str
// ConvertToObjectID returns a full-length SHA1 from a potential ID string
func ConvertToObjectID(ctx gocontext.Context, repo *context.Repository, commitID string) (git.ObjectID, error) {
- objectFormat, _ := repo.GitRepo.GetObjectFormat()
+ objectFormat := repo.GetObjectFormat()
if len(commitID) == objectFormat.FullLength() && objectFormat.IsValid(commitID) {
sha, err := git.NewIDFromString(commitID)
if err == nil {