summaryrefslogtreecommitdiffstats
path: root/services/migrations
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2023-12-17 12:56:08 +0100
committerGitHub <noreply@github.com>2023-12-17 12:56:08 +0100
commit408a4842240e7dd906e682196bd4254d6c76fcb9 (patch)
treeec3962d5769a5891a24b4d79f725673fc1e46e35 /services/migrations
parentRemove duplicate option in admin screen and now-unused translation keys (#28492) (diff)
downloadforgejo-408a4842240e7dd906e682196bd4254d6c76fcb9.tar.xz
forgejo-408a4842240e7dd906e682196bd4254d6c76fcb9.zip
Adjust object format interface (#28469)
- Remove `ObjectFormatID` - Remove function `ObjectFormatFromID`. - Use `Sha1ObjectFormat` directly but not a pointer because it's an empty struct. - Store `ObjectFormatName` in `repository` struct
Diffstat (limited to 'services/migrations')
-rw-r--r--services/migrations/common.go2
-rw-r--r--services/migrations/gitea_uploader_test.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/services/migrations/common.go b/services/migrations/common.go
index 278c156b03..d88518899d 100644
--- a/services/migrations/common.go
+++ b/services/migrations/common.go
@@ -49,7 +49,7 @@ func CheckAndEnsureSafePR(pr *base.PullRequest, commonCloneBaseURL string, g bas
// SECURITY: SHAs Must be a SHA
// FIXME: hash only a SHA1
- CommitType := git.ObjectFormatFromID(git.Sha1)
+ CommitType := git.Sha1ObjectFormat
if pr.MergeCommitSHA != "" && !CommitType.IsValid(pr.MergeCommitSHA) {
WarnAndNotice("PR #%d in %s has invalid MergeCommitSHA: %s", pr.Number, g, pr.MergeCommitSHA)
pr.MergeCommitSHA = ""
diff --git a/services/migrations/gitea_uploader_test.go b/services/migrations/gitea_uploader_test.go
index b6c9b81477..3dec3a26fc 100644
--- a/services/migrations/gitea_uploader_test.go
+++ b/services/migrations/gitea_uploader_test.go
@@ -232,7 +232,7 @@ func TestGiteaUploadUpdateGitForPullRequest(t *testing.T) {
//
fromRepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
baseRef := "master"
- assert.NoError(t, git.InitRepository(git.DefaultContext, fromRepo.RepoPath(), false, fromRepo.ObjectFormat))
+ assert.NoError(t, git.InitRepository(git.DefaultContext, fromRepo.RepoPath(), false, fromRepo.ObjectFormatName))
err := git.NewCommand(git.DefaultContext, "symbolic-ref").AddDynamicArguments("HEAD", git.BranchPrefix+baseRef).Run(&git.RunOpts{Dir: fromRepo.RepoPath()})
assert.NoError(t, err)
assert.NoError(t, os.WriteFile(filepath.Join(fromRepo.RepoPath(), "README.md"), []byte(fmt.Sprintf("# Testing Repository\n\nOriginally created in: %s", fromRepo.RepoPath())), 0o644))