Skip to content

Commit

Permalink
Add authenticator to all Git calls (makes it possible to have private…
Browse files Browse the repository at this point in the history
… repos)
  • Loading branch information
mstg committed Mar 25, 2022
1 parent 102ff04 commit 70c4c22
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/modes/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func (g *GitMode) RetrieveSource(pd *data.ProcessData) (*data.ModeData, error) {
}

err = remote.Fetch(&git.FetchOptions{
Auth: pd.Authenticator,
RefSpecs: []config.RefSpec{refspec},
Tags: git.AllTags,
Force: true,
Expand Down Expand Up @@ -120,7 +121,9 @@ func (g *GitMode) RetrieveSource(pd *data.ProcessData) (*data.ModeData, error) {
}
_ = tagIter.ForEach(tagAdd)

list, err := remote.List(&git.ListOptions{})
list, err := remote.List(&git.ListOptions{
Auth: pd.Authenticator,
})
if err != nil {
return nil, fmt.Errorf("could not list upstream: %v", err)
}
Expand Down Expand Up @@ -180,6 +183,7 @@ func (g *GitMode) WriteSource(pd *data.ProcessData, md *data.ModeData) error {
}
pd.Log.Printf("checking out upstream refspec %s", refspec)
err = remote.Fetch(&git.FetchOptions{
Auth: pd.Authenticator,
RemoteName: "upstream",
RefSpecs: []config.RefSpec{refspec},
Tags: git.AllTags,
Expand Down
1 change: 1 addition & 0 deletions pkg/srpmproc/patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ func executePatchesRpm(pd *data.ProcessData, md *data.ModeData) error {
}

fetchOptions := &git.FetchOptions{
Auth: pd.Authenticator,
RemoteName: "origin",
RefSpecs: []config.RefSpec{refspec},
}
Expand Down

0 comments on commit 70c4c22

Please sign in to comment.