squakez commented on code in PR #6873:
URL: https://github.com/apache/camel-k/pull/6873#discussion_r4219108294


##########
pkg/util/gitops/gitops.go:
##########
@@ -499,6 +503,13 @@ func GitToken(ctx context.Context, c client.Client, 
namespace, secret string) (s
 // CloneGitProject is in charge to clone the project from a given Git repo 
configuration.
 // If no secretToken is provided, then, it is assumed the project is public.
 func CloneGitProject(gitConf v1.GitConfigSpec, dir, secretToken string) 
(*git.Repository, error) {
+       return CloneGitProjectWithUsername(gitConf, dir, "", secretToken)
+}
+
+// CloneGitProjectWithUsername is in charge to clone the project from a given 
Git repo configuration,
+// authenticating with the given username and secretToken. If no username is 
provided, then, DefaultGitUsername is used.
+// If no secretToken is provided, then, it is assumed the project is public.
+func CloneGitProjectWithUsername(gitConf v1.GitConfigSpec, dir, username, 
secretToken string) (*git.Repository, error) {

Review Comment:
   I think we should refactor the `CloneGitProject` func, adding a new param 
and change the caller to provide a user name. It's the caller that has to 
provide the default.



##########
pkg/util/gitops/gitops.go:
##########
@@ -527,8 +538,11 @@ func CloneGitProject(gitConf v1.GitConfigSpec, dir, 
secretToken string) (*git.Re
        }
 
        if secretToken != "" {
+               if username == "" {

Review Comment:
   We should remove this and let the caller chose the value to provide



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to