aboutsummaryrefslogtreecommitdiffstats
path: root/services/wiki
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2023-12-17 19:56:08 +0800
committerGitHub <noreply@github.com>2023-12-17 11:56:08 +0000
commit408a4842240e7dd906e682196bd4254d6c76fcb9 (patch)
treeec3962d5769a5891a24b4d79f725673fc1e46e35 /services/wiki
parent7fb6b5147038649bfaa26147a6173cf99b322a30 (diff)
downloadgitea-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.go2
-rw-r--r--services/wiki/wiki_test.go2
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)