git: remove ', error:' from returned error
As we properly nest errors. Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
parent
8c581ddfbc
commit
c814e0fa26
|
@ -383,7 +383,7 @@ var _ = Describe("GitRepositoryReconciler", func() {
|
||||||
reference: &sourcev1.GitRepositoryRef{Branch: "main"},
|
reference: &sourcev1.GitRepositoryRef{Branch: "main"},
|
||||||
waitForReason: sourcev1.GitOperationFailedReason,
|
waitForReason: sourcev1.GitOperationFailedReason,
|
||||||
expectStatus: metav1.ConditionFalse,
|
expectStatus: metav1.ConditionFalse,
|
||||||
expectMessage: "error: user rejected certificate",
|
expectMessage: "unable to clone: user rejected certificate",
|
||||||
gitImplementation: sourcev1.LibGit2Implementation,
|
gitImplementation: sourcev1.LibGit2Implementation,
|
||||||
}),
|
}),
|
||||||
Entry("self signed libgit2 with CA", refTestCase{
|
Entry("self signed libgit2 with CA", refTestCase{
|
||||||
|
|
|
@ -79,7 +79,7 @@ func (c *CheckoutBranch) Checkout(ctx context.Context, path, url string, opts *g
|
||||||
CABundle: caBundle(opts),
|
CABundle: caBundle(opts),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to clone '%s', error: %w", url, gitutil.GoGitError(err))
|
return nil, fmt.Errorf("unable to clone '%s': %w", url, gitutil.GoGitError(err))
|
||||||
}
|
}
|
||||||
head, err := repo.Head()
|
head, err := repo.Head()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -117,7 +117,7 @@ func (c *CheckoutTag) Checkout(ctx context.Context, path, url string, opts *git.
|
||||||
CABundle: caBundle(opts),
|
CABundle: caBundle(opts),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to clone '%s', error: %w", url, gitutil.GoGitError(err))
|
return nil, fmt.Errorf("unable to clone '%s': %w", url, gitutil.GoGitError(err))
|
||||||
}
|
}
|
||||||
head, err := repo.Head()
|
head, err := repo.Head()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -158,7 +158,7 @@ func (c *CheckoutCommit) Checkout(ctx context.Context, path, url string, opts *g
|
||||||
}
|
}
|
||||||
repo, err := extgogit.PlainCloneContext(ctx, path, false, cloneOpts)
|
repo, err := extgogit.PlainCloneContext(ctx, path, false, cloneOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to clone '%s', error: %w", url, gitutil.GoGitError(err))
|
return nil, fmt.Errorf("unable to clone '%s': %w", url, gitutil.GoGitError(err))
|
||||||
}
|
}
|
||||||
w, err := repo.Worktree()
|
w, err := repo.Worktree()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -206,7 +206,7 @@ func (c *CheckoutSemVer) Checkout(ctx context.Context, path, url string, opts *g
|
||||||
CABundle: caBundle(opts),
|
CABundle: caBundle(opts),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to clone '%s', error: %w", url, err)
|
return nil, fmt.Errorf("unable to clone '%s': %w", url, gitutil.GoGitError(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
repoTags, err := repo.Tags()
|
repoTags, err := repo.Tags()
|
||||||
|
|
|
@ -126,7 +126,7 @@ func TestCheckoutTag_Checkout(t *testing.T) {
|
||||||
name: "Non existing tag",
|
name: "Non existing tag",
|
||||||
tag: "tag-1",
|
tag: "tag-1",
|
||||||
checkoutTag: "invalid",
|
checkoutTag: "invalid",
|
||||||
expectErr: "error: couldn't find remote ref \"refs/tags/invalid\"",
|
expectErr: "couldn't find remote ref \"refs/tags/invalid\"",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
|
|
@ -68,7 +68,7 @@ func (c *CheckoutBranch) Checkout(ctx context.Context, path, url string, opts *g
|
||||||
CheckoutBranch: c.Branch,
|
CheckoutBranch: c.Branch,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to clone '%s', error: %w", url, gitutil.LibGit2Error(err))
|
return nil, fmt.Errorf("unable to clone: %w", gitutil.LibGit2Error(err))
|
||||||
}
|
}
|
||||||
defer repo.Free()
|
defer repo.Free()
|
||||||
head, err := repo.Head()
|
head, err := repo.Head()
|
||||||
|
@ -96,7 +96,7 @@ func (c *CheckoutTag) Checkout(ctx context.Context, path, url string, opts *git.
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to clone '%s', error: %w", url, gitutil.LibGit2Error(err))
|
return nil, fmt.Errorf("unable to clone '%s': %w", url, gitutil.LibGit2Error(err))
|
||||||
}
|
}
|
||||||
defer repo.Free()
|
defer repo.Free()
|
||||||
cc, err := checkoutDetachedDwim(repo, c.Tag)
|
cc, err := checkoutDetachedDwim(repo, c.Tag)
|
||||||
|
@ -119,7 +119,7 @@ func (c *CheckoutCommit) Checkout(ctx context.Context, path, url string, opts *g
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to clone '%s', error: %w", url, gitutil.LibGit2Error(err))
|
return nil, fmt.Errorf("unable to clone '%s': %w", url, gitutil.LibGit2Error(err))
|
||||||
}
|
}
|
||||||
defer repo.Free()
|
defer repo.Free()
|
||||||
oid, err := git2go.NewOid(c.Commit)
|
oid, err := git2go.NewOid(c.Commit)
|
||||||
|
@ -150,7 +150,7 @@ func (c *CheckoutSemVer) Checkout(ctx context.Context, path, url string, opts *g
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to clone '%s', error: %w", url, gitutil.LibGit2Error(err))
|
return nil, fmt.Errorf("unable to clone '%s': %w", url, gitutil.LibGit2Error(err))
|
||||||
}
|
}
|
||||||
defer repo.Free()
|
defer repo.Free()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue