feat: use go git client by default

This commit is contained in:
mgukov 2023-03-06 12:48:03 +07:00
parent 6754025fa0
commit d8b7cc54ba
3 changed files with 17 additions and 4 deletions

13
lib/GitClientFactory.go Normal file
View File

@ -0,0 +1,13 @@
package lib
func CreateDefaultGitClient() GitClient {
return CreateGoGitClient()
}
func CreateGoGitClient() GitClient {
return GoGitClient{}
}
func CreateCmdGitClient() GitClient {
return CmdGitClient{}
}

View File

@ -31,7 +31,7 @@ func (r ScheduleRunner) tryUpdateScheduleCommitHash(schedule db.Schedule) (updat
Logger: nil,
TemplateID: schedule.TemplateID,
Repository: repo,
Client: lib.GoGitClient{},
Client: lib.CreateDefaultGitClient(),
}.GetLastRemoteCommitHash()
if err != nil {

View File

@ -60,7 +60,7 @@ func (t *TaskRunner) getRepoPath() string {
Logger: t,
TemplateID: t.template.ID,
Repository: t.repository,
Client: lib.GoGitClient{},
Client: lib.CreateDefaultGitClient(),
}
return repo.GetFullPath()
@ -439,7 +439,7 @@ func (t *TaskRunner) checkoutRepository() error {
Logger: t,
TemplateID: t.template.ID,
Repository: t.repository,
Client: lib.GoGitClient{},
Client: lib.CreateDefaultGitClient(),
}
err := repo.ValidateRepo()
@ -474,7 +474,7 @@ func (t *TaskRunner) updateRepository() error {
Logger: t,
TemplateID: t.template.ID,
Repository: t.repository,
Client: lib.GoGitClient{},
Client: lib.CreateDefaultGitClient(),
}
err := repo.ValidateRepo()