diff options
Diffstat (limited to 'internal')
-rw-r--r-- | internal/db/repo.go | 4 | ||||
-rw-r--r-- | internal/db/repo_editor.go | 72 |
2 files changed, 48 insertions, 28 deletions
diff --git a/internal/db/repo.go b/internal/db/repo.go index 1c85583a..9f17b9a5 100644 --- a/internal/db/repo.go +++ b/internal/db/repo.go @@ -1980,7 +1980,9 @@ func GitFsck() { repo := bean.(*Repository) repoPath := repo.RepoPath() err := git.Fsck(repoPath, git.FsckOptions{ - Args: conf.Cron.RepoHealthCheck.Args, + CommandOptions: git.CommandOptions{ + Args: conf.Cron.RepoHealthCheck.Args, + }, Timeout: conf.Cron.RepoHealthCheck.Timeout, }) if err != nil { diff --git a/internal/db/repo_editor.go b/internal/db/repo_editor.go index cf2426f6..71a8cfea 100644 --- a/internal/db/repo_editor.go +++ b/internal/db/repo_editor.go @@ -184,15 +184,21 @@ func (repo *Repository) UpdateRepoFile(doer *User, opts UpdateRepoFileOptions) ( return fmt.Errorf("commit changes on %q: %v", localPath, err) } - envs := ComposeHookEnvs(ComposeHookEnvsOptions{ - AuthUser: doer, - OwnerName: repo.MustOwner().Name, - OwnerSalt: repo.MustOwner().Salt, - RepoID: repo.ID, - RepoName: repo.Name, - RepoPath: repo.RepoPath(), - }) - if err = git.Push(localPath, "origin", opts.NewBranch, git.PushOptions{Envs: envs}); err != nil { + err = git.Push(localPath, "origin", opts.NewBranch, + git.PushOptions{ + CommandOptions: git.CommandOptions{ + Envs: ComposeHookEnvs(ComposeHookEnvsOptions{ + AuthUser: doer, + OwnerName: repo.MustOwner().Name, + OwnerSalt: repo.MustOwner().Salt, + RepoID: repo.ID, + RepoName: repo.Name, + RepoPath: repo.RepoPath(), + }), + }, + }, + ) + if err != nil { return fmt.Errorf("git push origin %s: %v", opts.NewBranch, err) } return nil @@ -289,15 +295,21 @@ func (repo *Repository) DeleteRepoFile(doer *User, opts DeleteRepoFileOptions) ( return fmt.Errorf("commit changes to %q: %v", localPath, err) } - envs := ComposeHookEnvs(ComposeHookEnvsOptions{ - AuthUser: doer, - OwnerName: repo.MustOwner().Name, - OwnerSalt: repo.MustOwner().Salt, - RepoID: repo.ID, - RepoName: repo.Name, - RepoPath: repo.RepoPath(), - }) - if err = git.Push(localPath, "origin", opts.NewBranch, git.PushOptions{Envs: envs}); err != nil { + err = git.Push(localPath, "origin", opts.NewBranch, + git.PushOptions{ + CommandOptions: git.CommandOptions{ + Envs: ComposeHookEnvs(ComposeHookEnvsOptions{ + AuthUser: doer, + OwnerName: repo.MustOwner().Name, + OwnerSalt: repo.MustOwner().Salt, + RepoID: repo.ID, + RepoName: repo.Name, + RepoPath: repo.RepoPath(), + }), + }, + }, + ) + if err != nil { return fmt.Errorf("git push origin %s: %v", opts.NewBranch, err) } return nil @@ -513,15 +525,21 @@ func (repo *Repository) UploadRepoFiles(doer *User, opts UploadRepoFileOptions) return fmt.Errorf("commit changes on %q: %v", localPath, err) } - envs := ComposeHookEnvs(ComposeHookEnvsOptions{ - AuthUser: doer, - OwnerName: repo.MustOwner().Name, - OwnerSalt: repo.MustOwner().Salt, - RepoID: repo.ID, - RepoName: repo.Name, - RepoPath: repo.RepoPath(), - }) - if err = git.Push(localPath, "origin", opts.NewBranch, git.PushOptions{Envs: envs}); err != nil { + err = git.Push(localPath, "origin", opts.NewBranch, + git.PushOptions{ + CommandOptions: git.CommandOptions{ + Envs: ComposeHookEnvs(ComposeHookEnvsOptions{ + AuthUser: doer, + OwnerName: repo.MustOwner().Name, + OwnerSalt: repo.MustOwner().Salt, + RepoID: repo.ID, + RepoName: repo.Name, + RepoPath: repo.RepoPath(), + }), + }, + }, + ) + if err != nil { return fmt.Errorf("git push origin %s: %v", opts.NewBranch, err) } |