Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(appdetect) Do not crash if the git config has a remote without any URL #755

Merged
merged 1 commit into from
Aug 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* fix(error): interpret raw newline [#744](https://github.com/Scalingo/cli/pull/744)
* fix(stats): display memory as IEC size [#742](https://github.com/Scalingo/cli/pull/742)
* fix(autoscalers): min containers cannot be 1 [#741](https://github.com/Scalingo/cli/pull/741)
* fix(appdetect): Do not crash if there is a remote without any URL [#755](https://github.com/Scalingo/cli/pull/755)
* refactor(run_unix): replace github.com/heroku/hk/term with golang.org/x/term [#740](https://github.com/Scalingo/cli/pull/740)
* build(deps): bump github.com/stretchr/testify from 1.7.2 to 1.8.0
* build(deps): bump github.com/cheggaaa/pb/v3 from 3.0.8 to 3.1.0
Expand Down
4 changes: 4 additions & 0 deletions utils/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ func ScalingoGitRemotes(directory string) ([]*git.Remote, error) {

matchedRemotes := []*git.Remote{}
for _, remote := range remotes {
if len(remote.Config().URLs) == 0 {
continue
}

remoteURL := remote.Config().URLs[0]
matched, err := regexp.Match(".*scalingo.com:.*.git", []byte(remoteURL))
if err != nil || !matched {
Expand Down