diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2023-12-17 19:56:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-17 11:56:08 +0000 |
commit | 408a4842240e7dd906e682196bd4254d6c76fcb9 (patch) | |
tree | ec3962d5769a5891a24b4d79f725673fc1e46e35 /services/wiki | |
parent | 7fb6b5147038649bfaa26147a6173cf99b322a30 (diff) | |
download | gitea-408a4842240e7dd906e682196bd4254d6c76fcb9.tar.gz gitea-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/wiki')
-rw-r--r-- | services/wiki/wiki.go | 2 | ||||
-rw-r--r-- | services/wiki/wiki_test.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/services/wiki/wiki.go b/services/wiki/wiki.go index ecda926ec1..f98854c8dd 100644 --- a/services/wiki/wiki.go +++ b/services/wiki/wiki.go @@ -36,7 +36,7 @@ func InitWiki(ctx context.Context, repo *repo_model.Repository) error { return nil } - if err := git.InitRepository(ctx, repo.WikiPath(), true, git.ObjectFormatFromID(git.Sha1)); err != nil { + if err := git.InitRepository(ctx, repo.WikiPath(), true, repo.ObjectFormatName); err != nil { return fmt.Errorf("InitRepository: %w", err) } else if err = repo_module.CreateDelegateHooks(repo.WikiPath()); err != nil { return fmt.Errorf("createDelegateHooks: %w", err) diff --git a/services/wiki/wiki_test.go b/services/wiki/wiki_test.go index 9981fb4258..277fa086ac 100644 --- a/services/wiki/wiki_test.go +++ b/services/wiki/wiki_test.go @@ -302,7 +302,7 @@ func TestPrepareWikiFileName_FirstPage(t *testing.T) { // Now create a temporaryDirectory tmpDir := t.TempDir() - err := git.InitRepository(git.DefaultContext, tmpDir, true, git.ObjectFormatFromID(git.Sha1)) + err := git.InitRepository(git.DefaultContext, tmpDir, true, git.Sha1ObjectFormat.Name()) assert.NoError(t, err) gitRepo, err := git.OpenRepository(git.DefaultContext, tmpDir) |