Merge "Add document pull step to gate script runner"

This commit is contained in:
Zuul
2020-09-28 22:45:02 +00:00
committed by Gerrit Code Review
26 changed files with 76 additions and 150 deletions

View File

@@ -217,11 +217,10 @@ func (repo *Repository) ToAuth() (transport.AuthMethod, error) {
// ToCheckoutOptions returns an instance of git.CheckoutOptions with
// respective values(Branch/Tag/Hash) in checkout options initialized
// CheckoutOptions describes how a checkout operation should be performed
func (repo *Repository) ToCheckoutOptions(force bool) *git.CheckoutOptions {
co := &git.CheckoutOptions{
Force: force,
}
func (repo *Repository) ToCheckoutOptions() *git.CheckoutOptions {
co := &git.CheckoutOptions{}
if repo.CheckoutOptions != nil {
co.Force = repo.CheckoutOptions.ForceCheckout
switch {
case repo.CheckoutOptions.Branch != "":
co.Branch = plumbing.NewBranchReferenceName(repo.CheckoutOptions.Branch)
@@ -238,19 +237,10 @@ func (repo *Repository) ToCheckoutOptions(force bool) *git.CheckoutOptions {
// authentication and URL set
// CloneOptions describes how a clone should be performed
func (repo *Repository) ToCloneOptions(auth transport.AuthMethod) *git.CloneOptions {
cl := &git.CloneOptions{
return &git.CloneOptions{
Auth: auth,
URL: repo.URLString,
}
if repo.CheckoutOptions != nil {
switch {
case repo.CheckoutOptions.Branch != "":
cl.ReferenceName = plumbing.NewBranchReferenceName(repo.CheckoutOptions.Branch)
case repo.CheckoutOptions.Tag != "":
cl.ReferenceName = plumbing.NewTagReferenceName(repo.CheckoutOptions.Tag)
}
}
return cl
}
// ToFetchOptions returns an instance of git.FetchOptions for given authentication

View File

@@ -182,7 +182,7 @@ func TestToCheckout(t *testing.T) {
for _, name := range testCase.dataMapEntry {
repo := data.TestData[name]
require.NotNil(t, repo)
co := repo.ToCheckoutOptions(false)
co := repo.ToCheckoutOptions()
if testCase.expectedNil {
assert.Nil(t, co)
} else {