summaryrefslogtreecommitdiffstats
path: root/services/pull/check.go
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 /services/pull/check.go
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 'services/pull/check.go')
-rw-r--r--services/pull/check.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/services/pull/check.go b/services/pull/check.go
index dd6c3ed230..f4dd332b14 100644
--- a/services/pull/check.go
+++ b/services/pull/check.go
@@ -222,10 +222,7 @@ func getMergeCommit(ctx context.Context, pr *issues_model.PullRequest) (*git.Com
}
defer gitRepo.Close()
- objectFormat, err := gitRepo.GetObjectFormat()
- if err != nil {
- return nil, fmt.Errorf("%-v GetObjectFormat: %w", pr.BaseRepo, err)
- }
+ objectFormat := git.ObjectFormatFromName(pr.BaseRepo.ObjectFormatName)
// Get the commit from BaseBranch where the pull request got merged
mergeCommit, _, err := git.NewCommand(ctx, "rev-list", "--ancestry-path", "--merges", "--reverse").