@@ -37,8 +37,8 @@ import (
37
37
)
38
38
39
39
type RepositoryManager interface {
40
- Fetch (userName , password string , url string , location string ) (updated bool , repo * git.Repository , err error )
41
- Add (gitProviderId int , location , url string , userName , password string , authMode sql.AuthMode , sshPrivateKeyContent string ) error
40
+ Fetch (gitContext * GitContext , url string , location string ) (updated bool , repo * git.Repository , err error )
41
+ Add (gitProviderId int , location , url string , gitContext * GitContext , authMode sql.AuthMode , sshPrivateKeyContent string ) error
42
42
Clean (cloneDir string ) error
43
43
ChangesSince (checkoutPath string , branch string , from string , to string , count int ) ([]* GitCommit , error )
44
44
ChangesSinceByRepository (repository * git.Repository , branch string , from string , to string , count int ) ([]* GitCommit , error )
@@ -58,7 +58,7 @@ func NewRepositoryManagerImpl(logger *zap.SugaredLogger, gitUtil *GitUtil, confi
58
58
return & RepositoryManagerImpl {logger : logger , gitUtil : gitUtil , configuration : configuration }
59
59
}
60
60
61
- func (impl RepositoryManagerImpl ) Add (gitProviderId int , location string , url string , userName , password string , authMode sql.AuthMode , sshPrivateKeyContent string ) error {
61
+ func (impl RepositoryManagerImpl ) Add (gitProviderId int , location string , url string , gitContext * GitContext , authMode sql.AuthMode , sshPrivateKeyContent string ) error {
62
62
var err error
63
63
start := time .Now ()
64
64
defer func () {
@@ -83,7 +83,7 @@ func (impl RepositoryManagerImpl) Add(gitProviderId int, location string, url st
83
83
}
84
84
}
85
85
86
- opt , errorMsg , err := impl .gitUtil .Fetch (location , userName , password )
86
+ opt , errorMsg , err := impl .gitUtil .Fetch (gitContext , location )
87
87
if err != nil {
88
88
impl .logger .Errorw ("error in cloning repo" , "errorMsg" , errorMsg , "err" , err )
89
89
return err
@@ -117,7 +117,7 @@ func (impl RepositoryManagerImpl) clone(auth transport.AuthMethod, cloneDir stri
117
117
return repo , err
118
118
}
119
119
120
- func (impl RepositoryManagerImpl ) Fetch (userName , password string , url string , location string ) (updated bool , repo * git.Repository , err error ) {
120
+ func (impl RepositoryManagerImpl ) Fetch (gitContext * GitContext , url string , location string ) (updated bool , repo * git.Repository , err error ) {
121
121
start := time .Now ()
122
122
defer func () {
123
123
util .TriggerGitOperationMetrics ("fetch" , start , err )
@@ -127,7 +127,7 @@ func (impl RepositoryManagerImpl) Fetch(userName, password string, url string, l
127
127
if err != nil {
128
128
return false , nil , err
129
129
}
130
- res , errorMsg , err := impl .gitUtil .Fetch (location , userName , password )
130
+ res , errorMsg , err := impl .gitUtil .Fetch (gitContext , location )
131
131
if err == nil && len (res ) > 0 {
132
132
impl .logger .Infow ("repository updated" , "location" , url )
133
133
//updated
0 commit comments