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
This commit is contained in:
parent
7fb6b51470
commit
408a484224
54 changed files with 191 additions and 203 deletions
|
@ -39,7 +39,7 @@ func ProcReceive(ctx context.Context, repo *repo_model.Repository, gitRepo *git.
|
|||
objectFormat, _ := gitRepo.GetObjectFormat()
|
||||
|
||||
for i := range opts.OldCommitIDs {
|
||||
if opts.NewCommitIDs[i] == objectFormat.Empty().String() {
|
||||
if opts.NewCommitIDs[i] == objectFormat.EmptyObjectID().String() {
|
||||
results = append(results, private.HookProcReceiveRefResult{
|
||||
OriginalRef: opts.RefFullNames[i],
|
||||
OldOID: opts.OldCommitIDs[i],
|
||||
|
@ -153,7 +153,7 @@ func ProcReceive(ctx context.Context, repo *repo_model.Repository, gitRepo *git.
|
|||
results = append(results, private.HookProcReceiveRefResult{
|
||||
Ref: pr.GetGitRefName(),
|
||||
OriginalRef: opts.RefFullNames[i],
|
||||
OldOID: objectFormat.Empty().String(),
|
||||
OldOID: objectFormat.EmptyObjectID().String(),
|
||||
NewOID: opts.NewCommitIDs[i],
|
||||
})
|
||||
continue
|
||||
|
|
|
@ -19,12 +19,12 @@ import (
|
|||
func TestToCommitMeta(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
headRepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
|
||||
sha1 := git.ObjectFormatFromID(git.Sha1)
|
||||
sha1 := git.Sha1ObjectFormat
|
||||
signature := &git.Signature{Name: "Test Signature", Email: "test@email.com", When: time.Unix(0, 0)}
|
||||
tag := &git.Tag{
|
||||
Name: "Test Tag",
|
||||
ID: sha1.Empty(),
|
||||
Object: sha1.Empty(),
|
||||
ID: sha1.EmptyObjectID(),
|
||||
Object: sha1.EmptyObjectID(),
|
||||
Type: "Test Type",
|
||||
Tagger: signature,
|
||||
Message: "Test Message",
|
||||
|
@ -34,8 +34,8 @@ func TestToCommitMeta(t *testing.T) {
|
|||
|
||||
assert.NotNil(t, commitMeta)
|
||||
assert.EqualValues(t, &api.CommitMeta{
|
||||
SHA: sha1.Empty().String(),
|
||||
URL: util.URLJoin(headRepo.APIURL(), "git/commits", sha1.Empty().String()),
|
||||
SHA: sha1.EmptyObjectID().String(),
|
||||
URL: util.URLJoin(headRepo.APIURL(), "git/commits", sha1.EmptyObjectID().String()),
|
||||
Created: time.Unix(0, 0),
|
||||
}, commitMeta)
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import (
|
|||
issues_model "code.gitea.io/gitea/models/issues"
|
||||
project_model "code.gitea.io/gitea/models/project"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/web/middleware"
|
||||
|
@ -54,7 +53,7 @@ type CreateRepoForm struct {
|
|||
TrustModel string
|
||||
|
||||
ForkSingleBranch string
|
||||
ObjectFormat git.ObjectFormat
|
||||
ObjectFormatName string
|
||||
}
|
||||
|
||||
// Validate validates the fields
|
||||
|
|
|
@ -1120,7 +1120,7 @@ func GetDiff(ctx context.Context, gitRepo *git.Repository, opts *DiffOptions, fi
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if (len(opts.BeforeCommitID) == 0 || opts.BeforeCommitID == objectFormat.Empty().String()) && commit.ParentCount() == 0 {
|
||||
if (len(opts.BeforeCommitID) == 0 || opts.BeforeCommitID == objectFormat.EmptyObjectID().String()) && commit.ParentCount() == 0 {
|
||||
cmdDiff.AddArguments("diff", "--src-prefix=\\a/", "--dst-prefix=\\b/", "-M").
|
||||
AddArguments(opts.WhitespaceBehavior...).
|
||||
AddDynamicArguments(objectFormat.EmptyTree().String()).
|
||||
|
@ -1229,7 +1229,7 @@ func GetDiff(ctx context.Context, gitRepo *git.Repository, opts *DiffOptions, fi
|
|||
}
|
||||
|
||||
diffPaths := []string{opts.BeforeCommitID + separator + opts.AfterCommitID}
|
||||
if len(opts.BeforeCommitID) == 0 || opts.BeforeCommitID == objectFormat.Empty().String() {
|
||||
if len(opts.BeforeCommitID) == 0 || opts.BeforeCommitID == objectFormat.EmptyObjectID().String() {
|
||||
diffPaths = []string{objectFormat.EmptyTree().String(), opts.AfterCommitID}
|
||||
}
|
||||
diff.NumFiles, diff.TotalAddition, diff.TotalDeletion, err = git.GetDiffShortStat(gitRepo.Ctx, repoPath, nil, diffPaths...)
|
||||
|
@ -1267,7 +1267,7 @@ func GetPullDiffStats(gitRepo *git.Repository, opts *DiffOptions) (*PullDiffStat
|
|||
}
|
||||
|
||||
diffPaths := []string{opts.BeforeCommitID + separator + opts.AfterCommitID}
|
||||
if len(opts.BeforeCommitID) == 0 || opts.BeforeCommitID == objectFormat.Empty().String() {
|
||||
if len(opts.BeforeCommitID) == 0 || opts.BeforeCommitID == objectFormat.EmptyObjectID().String() {
|
||||
diffPaths = []string{objectFormat.EmptyTree().String(), opts.AfterCommitID}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 = ""
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -484,7 +484,7 @@ func SyncPullMirror(ctx context.Context, repoID int64) bool {
|
|||
}
|
||||
notify_service.SyncPushCommits(ctx, m.Repo.MustOwner(ctx), m.Repo, &repo_module.PushUpdateOptions{
|
||||
RefFullName: result.refName,
|
||||
OldCommitID: objectFormat.Empty().String(),
|
||||
OldCommitID: objectFormat.EmptyObjectID().String(),
|
||||
NewCommitID: commitID,
|
||||
}, repo_module.NewPushCommits())
|
||||
notify_service.SyncCreateRef(ctx, m.Repo.MustOwner(ctx), m.Repo, result.refName, commitID)
|
||||
|
|
|
@ -271,7 +271,7 @@ func alterRepositoryContent(ctx context.Context, doer *user_model.User, repo *re
|
|||
if !git.IsErrBranchNotExist(err) || !repo.IsEmpty {
|
||||
return err
|
||||
}
|
||||
if err := t.Init(repo.ObjectFormat); err != nil {
|
||||
if err := t.Init(repo.ObjectFormatName); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -328,7 +328,7 @@ func AddTestPullRequestTask(doer *user_model.User, repoID int64, branch string,
|
|||
if err == nil {
|
||||
for _, pr := range prs {
|
||||
objectFormat, _ := git.GetObjectFormatOfRepo(ctx, pr.BaseRepo.RepoPath())
|
||||
if newCommitID != "" && newCommitID != objectFormat.Empty().String() {
|
||||
if newCommitID != "" && newCommitID != objectFormat.EmptyObjectID().String() {
|
||||
changed, err := checkIfPRContentChanged(ctx, pr, oldCommitID, newCommitID)
|
||||
if err != nil {
|
||||
log.Error("checkIfPRContentChanged: %v", err)
|
||||
|
|
|
@ -93,14 +93,8 @@ func createTemporaryRepoForPR(ctx context.Context, pr *issues_model.PullRequest)
|
|||
|
||||
baseRepoPath := pr.BaseRepo.RepoPath()
|
||||
headRepoPath := pr.HeadRepo.RepoPath()
|
||||
objectFormat, err := git.GetObjectFormatOfRepo(ctx, baseRepoPath)
|
||||
if err != nil {
|
||||
log.Error("Unable to fetch ObjectFormat of repository %s: %v", baseRepoPath, err)
|
||||
cancel()
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
if err := git.InitRepository(ctx, tmpBasePath, false, objectFormat); err != nil {
|
||||
if err := git.InitRepository(ctx, tmpBasePath, false, pr.BaseRepo.ObjectFormatName); err != nil {
|
||||
log.Error("Unable to init tmpBasePath for %-v: %v", pr, err)
|
||||
cancel()
|
||||
return nil, nil, err
|
||||
|
@ -174,6 +168,7 @@ func createTemporaryRepoForPR(ctx context.Context, pr *issues_model.PullRequest)
|
|||
}
|
||||
|
||||
trackingBranch := "tracking"
|
||||
objectFormat := git.ObjectFormatFromName(pr.BaseRepo.ObjectFormatName)
|
||||
// Fetch head branch
|
||||
var headBranch string
|
||||
if pr.Flow == issues_model.PullRequestFlowGithub {
|
||||
|
|
|
@ -89,14 +89,14 @@ func createTag(ctx context.Context, gitRepo *git.Repository, rel *repo_model.Rel
|
|||
objectFormat, _ := gitRepo.GetObjectFormat()
|
||||
commits := repository.NewPushCommits()
|
||||
commits.HeadCommit = repository.CommitToPushCommit(commit)
|
||||
commits.CompareURL = rel.Repo.ComposeCompareURL(objectFormat.Empty().String(), commit.ID.String())
|
||||
commits.CompareURL = rel.Repo.ComposeCompareURL(objectFormat.EmptyObjectID().String(), commit.ID.String())
|
||||
|
||||
refFullName := git.RefNameFromTag(rel.TagName)
|
||||
notify_service.PushCommits(
|
||||
ctx, rel.Publisher, rel.Repo,
|
||||
&repository.PushUpdateOptions{
|
||||
RefFullName: refFullName,
|
||||
OldCommitID: objectFormat.Empty().String(),
|
||||
OldCommitID: objectFormat.EmptyObjectID().String(),
|
||||
NewCommitID: commit.ID.String(),
|
||||
}, commits)
|
||||
notify_service.CreateRef(ctx, rel.Publisher, rel.Repo, refFullName, commit.ID.String())
|
||||
|
@ -335,7 +335,7 @@ func DeleteReleaseByID(ctx context.Context, repo *repo_model.Repository, rel *re
|
|||
&repository.PushUpdateOptions{
|
||||
RefFullName: refName,
|
||||
OldCommitID: rel.Sha1,
|
||||
NewCommitID: objectFormat.Empty().String(),
|
||||
NewCommitID: objectFormat.EmptyObjectID().String(),
|
||||
}, repository.NewPushCommits())
|
||||
notify_service.DeleteRef(ctx, doer, repo, refName)
|
||||
|
||||
|
|
|
@ -408,7 +408,7 @@ func DeleteBranch(ctx context.Context, doer *user_model.User, repo *repo_model.R
|
|||
&repo_module.PushUpdateOptions{
|
||||
RefFullName: git.RefNameFromBranch(branchName),
|
||||
OldCommitID: commit.ID.String(),
|
||||
NewCommitID: objectFormat.Empty().String(),
|
||||
NewCommitID: objectFormat.EmptyObjectID().String(),
|
||||
PusherID: doer.ID,
|
||||
PusherName: doer.Name,
|
||||
RepoUserName: repo.OwnerName,
|
||||
|
|
|
@ -192,7 +192,7 @@ func ReinitMissingRepositories(ctx context.Context) error {
|
|||
default:
|
||||
}
|
||||
log.Trace("Initializing %d/%d...", repo.OwnerID, repo.ID)
|
||||
if err := git.InitRepository(ctx, repo.RepoPath(), true, repo.ObjectFormat); err != nil {
|
||||
if err := git.InitRepository(ctx, repo.RepoPath(), true, repo.ObjectFormatName); err != nil {
|
||||
log.Error("Unable (re)initialize repository %d at %s. Error: %v", repo.ID, repo.RepoPath(), err)
|
||||
if err2 := system_model.CreateRepositoryNotice("InitRepository [%d]: %v", repo.ID, err); err2 != nil {
|
||||
log.Error("CreateRepositoryNotice: %v", err2)
|
||||
|
|
|
@ -27,23 +27,23 @@ import (
|
|||
|
||||
// CreateRepoOptions contains the create repository options
|
||||
type CreateRepoOptions struct {
|
||||
Name string
|
||||
Description string
|
||||
OriginalURL string
|
||||
GitServiceType api.GitServiceType
|
||||
Gitignores string
|
||||
IssueLabels string
|
||||
License string
|
||||
Readme string
|
||||
DefaultBranch string
|
||||
IsPrivate bool
|
||||
IsMirror bool
|
||||
IsTemplate bool
|
||||
AutoInit bool
|
||||
Status repo_model.RepositoryStatus
|
||||
TrustModel repo_model.TrustModelType
|
||||
MirrorInterval string
|
||||
ObjectFormat git.ObjectFormat
|
||||
Name string
|
||||
Description string
|
||||
OriginalURL string
|
||||
GitServiceType api.GitServiceType
|
||||
Gitignores string
|
||||
IssueLabels string
|
||||
License string
|
||||
Readme string
|
||||
DefaultBranch string
|
||||
IsPrivate bool
|
||||
IsMirror bool
|
||||
IsTemplate bool
|
||||
AutoInit bool
|
||||
Status repo_model.RepositoryStatus
|
||||
TrustModel repo_model.TrustModelType
|
||||
MirrorInterval string
|
||||
ObjectFormatName string
|
||||
}
|
||||
|
||||
func prepareRepoCommit(ctx context.Context, repo *repo_model.Repository, tmpDir, repoPath string, opts CreateRepoOptions) error {
|
||||
|
@ -135,7 +135,7 @@ func prepareRepoCommit(ctx context.Context, repo *repo_model.Repository, tmpDir,
|
|||
|
||||
// InitRepository initializes README and .gitignore if needed.
|
||||
func initRepository(ctx context.Context, repoPath string, u *user_model.User, repo *repo_model.Repository, opts CreateRepoOptions) (err error) {
|
||||
if err = repo_module.CheckInitRepository(ctx, repo.OwnerName, repo.Name, opts.ObjectFormat); err != nil {
|
||||
if err = repo_module.CheckInitRepository(ctx, repo.OwnerName, repo.Name, opts.ObjectFormatName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -210,10 +210,6 @@ func CreateRepositoryDirectly(ctx context.Context, doer, u *user_model.User, opt
|
|||
opts.DefaultBranch = setting.Repository.DefaultBranch
|
||||
}
|
||||
|
||||
if opts.ObjectFormat == nil {
|
||||
opts.ObjectFormat = git.ObjectFormatFromID(git.Sha1)
|
||||
}
|
||||
|
||||
// Check if label template exist
|
||||
if len(opts.IssueLabels) > 0 {
|
||||
if _, err := repo_module.LoadTemplateLabelsByDisplayName(opts.IssueLabels); err != nil {
|
||||
|
@ -239,7 +235,7 @@ func CreateRepositoryDirectly(ctx context.Context, doer, u *user_model.User, opt
|
|||
TrustModel: opts.TrustModel,
|
||||
IsMirror: opts.IsMirror,
|
||||
DefaultBranch: opts.DefaultBranch,
|
||||
ObjectFormat: opts.ObjectFormat,
|
||||
ObjectFormatName: opts.ObjectFormatName,
|
||||
}
|
||||
|
||||
var rollbackRepo *repo_model.Repository
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
"code.gitea.io/gitea/models"
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/services/pull"
|
||||
|
@ -66,7 +67,7 @@ func CherryPick(ctx context.Context, repo *repo_model.Repository, doer *user_mod
|
|||
}
|
||||
parent, err := commit.ParentID(0)
|
||||
if err != nil {
|
||||
parent = repo.ObjectFormat.EmptyTree()
|
||||
parent = git.ObjectFormatFromName(repo.ObjectFormatName).EmptyTree()
|
||||
}
|
||||
|
||||
base, right := parent.String(), commit.ID.String()
|
||||
|
|
|
@ -77,8 +77,8 @@ func (t *TemporaryUploadRepository) Clone(branch string) error {
|
|||
}
|
||||
|
||||
// Init the repository
|
||||
func (t *TemporaryUploadRepository) Init(objectFormat git.ObjectFormat) error {
|
||||
if err := git.InitRepository(t.ctx, t.basePath, false, objectFormat); err != nil {
|
||||
func (t *TemporaryUploadRepository) Init(objectFormatName string) error {
|
||||
if err := git.InitRepository(t.ctx, t.basePath, false, objectFormatName); err != nil {
|
||||
return err
|
||||
}
|
||||
gitRepo, err := git.OpenRepository(t.ctx, t.basePath)
|
||||
|
|
|
@ -155,8 +155,7 @@ func ChangeRepoFiles(ctx context.Context, repo *repo_model.Repository, doer *use
|
|||
if !git.IsErrBranchNotExist(err) || !repo.IsEmpty {
|
||||
return nil, err
|
||||
}
|
||||
objectFormat, _ := gitRepo.GetObjectFormat()
|
||||
if err := t.Init(objectFormat); err != nil {
|
||||
if err := t.Init(repo.ObjectFormatName); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
hasOldBranch = false
|
||||
|
|
|
@ -91,7 +91,7 @@ func UploadRepoFiles(ctx context.Context, repo *repo_model.Repository, doer *use
|
|||
if !git.IsErrBranchNotExist(err) || !repo.IsEmpty {
|
||||
return err
|
||||
}
|
||||
if err = t.Init(repo.ObjectFormat); err != nil {
|
||||
if err = t.Init(repo.ObjectFormatName); err != nil {
|
||||
return err
|
||||
}
|
||||
hasOldBranch = false
|
||||
|
|
|
@ -111,7 +111,7 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
|
|||
log.Trace("pushUpdates: %-v %s %s %s", repo, opts.OldCommitID, opts.NewCommitID, opts.RefFullName)
|
||||
|
||||
if opts.IsNewRef() && opts.IsDelRef() {
|
||||
return fmt.Errorf("old and new revisions are both %s", objectFormat.Empty())
|
||||
return fmt.Errorf("old and new revisions are both %s", objectFormat.EmptyObjectID())
|
||||
}
|
||||
if opts.RefFullName.IsTag() {
|
||||
if pusher == nil || pusher.ID != opts.PusherID {
|
||||
|
@ -131,7 +131,7 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
|
|||
&repo_module.PushUpdateOptions{
|
||||
RefFullName: git.RefNameFromTag(tagName),
|
||||
OldCommitID: opts.OldCommitID,
|
||||
NewCommitID: objectFormat.Empty().String(),
|
||||
NewCommitID: objectFormat.EmptyObjectID().String(),
|
||||
}, repo_module.NewPushCommits())
|
||||
|
||||
delTags = append(delTags, tagName)
|
||||
|
@ -144,13 +144,13 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
|
|||
|
||||
commits := repo_module.NewPushCommits()
|
||||
commits.HeadCommit = repo_module.CommitToPushCommit(newCommit)
|
||||
commits.CompareURL = repo.ComposeCompareURL(objectFormat.Empty().String(), opts.NewCommitID)
|
||||
commits.CompareURL = repo.ComposeCompareURL(objectFormat.EmptyObjectID().String(), opts.NewCommitID)
|
||||
|
||||
notify_service.PushCommits(
|
||||
ctx, pusher, repo,
|
||||
&repo_module.PushUpdateOptions{
|
||||
RefFullName: opts.RefFullName,
|
||||
OldCommitID: objectFormat.Empty().String(),
|
||||
OldCommitID: objectFormat.EmptyObjectID().String(),
|
||||
NewCommitID: opts.NewCommitID,
|
||||
}, commits)
|
||||
|
||||
|
@ -234,7 +234,7 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
|
|||
}
|
||||
|
||||
oldCommitID := opts.OldCommitID
|
||||
if oldCommitID == objectFormat.Empty().String() && len(commits.Commits) > 0 {
|
||||
if oldCommitID == objectFormat.EmptyObjectID().String() && len(commits.Commits) > 0 {
|
||||
oldCommit, err := gitRepo.GetCommit(commits.Commits[len(commits.Commits)-1].Sha1)
|
||||
if err != nil && !git.IsErrNotExist(err) {
|
||||
log.Error("unable to GetCommit %s from %-v: %v", oldCommitID, repo, err)
|
||||
|
@ -250,11 +250,11 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
|
|||
}
|
||||
}
|
||||
|
||||
if oldCommitID == objectFormat.Empty().String() && repo.DefaultBranch != branch {
|
||||
if oldCommitID == objectFormat.EmptyObjectID().String() && repo.DefaultBranch != branch {
|
||||
oldCommitID = repo.DefaultBranch
|
||||
}
|
||||
|
||||
if oldCommitID != objectFormat.Empty().String() {
|
||||
if oldCommitID != objectFormat.EmptyObjectID().String() {
|
||||
commits.CompareURL = repo.ComposeCompareURL(oldCommitID, opts.NewCommitID)
|
||||
} else {
|
||||
commits.CompareURL = ""
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue