Skip to content

Commit

Permalink
Remove unused param
Browse files Browse the repository at this point in the history
  • Loading branch information
KnVerey committed Jan 10, 2023
1 parent a885ee1 commit c288564
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/internal/git/repospec.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func extractHost(n string) (string, string) {

// Validate the username and scheme before attempting host/path parsing, because if the parsing
// so far has not succeeded, we will not be able to extract the host and path correctly.
if err := validateUsernameAndScheme(username, scheme, acceptSCP); err != nil {
if err := validateScheme(scheme, acceptSCP); err != nil {
// TODO: return this error instead.
return "", n
}
Expand Down Expand Up @@ -290,13 +290,13 @@ func acceptSCPStyle(scheme, username string, isGithubURL bool) bool {
return scheme == "" && (username != "" || isGithubURL)
}

func validateUsernameAndScheme(username, scheme string, acceptSCPStyle bool) error {
func validateScheme(scheme string, acceptSCPStyle bool) error {
// see https://git-scm.com/docs/git-fetch#_git_urls for info relevant to these validations
switch scheme {
case "":
// Empty scheme is only ok if it's a Github URL or if it looks like SCP-style syntax
if !acceptSCPStyle {
return fmt.Errorf("no username or scheme found")
return fmt.Errorf("failed to parse scheme")
}
case "ssh://", "file://", "https://", "http://":
// These are all supported schemes
Expand Down

0 comments on commit c288564

Please sign in to comment.