Skip to content

Commit

Permalink
fix: correctly handle git@ clone URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
femnad committed Feb 5, 2024
1 parent 37b5c62 commit fcea88e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
13 changes: 9 additions & 4 deletions entity/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ import (
)

const (
defaultHost = "github.com"
defaultRemote = "origin"
gitRepoSuffix = ".git"
defaultHost = "github.com"
defaultRemote = "origin"
gitClonePrefix = "git@"
gitRepoSuffix = ".git"
)

type cloneRef struct {
Expand All @@ -40,7 +41,11 @@ func processUrl(repoUrl string) (cloneRef, error) {
}
ref.base = repoBase

// Doesn't expect git@<host>:<user>/<repo> URLs.
if strings.HasPrefix(repoUrl, gitClonePrefix) {
ref.url = repoUrl
return ref, nil
}

parsed, err := url.Parse(repoUrl)
if err != nil {
return ref, err
Expand Down
3 changes: 3 additions & 0 deletions entity/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ func runShellCmd(step Step, cfg Config) error {

func runGitClone(step Step, cfg Config) error {
path := ExpandSettings(cfg.Settings, step.Dir)
if path == "" {
return fmt.Errorf("cannot clone repo %s without a path for step", step.Repo.Name)
}
return CloneTo(step.Repo, path)
}

Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

const (
version = "0.31.9"
version = "0.31.10"
)

type args struct {
Expand Down

0 comments on commit fcea88e

Please sign in to comment.