From 4cb910471f3472f2f580dc80b11855542ec400c9 Mon Sep 17 00:00:00 2001 From: Jan Koehnlein Date: Tue, 15 Jun 2021 09:56:46 +0200 Subject: [PATCH] [cli] correctly detect URL of git submodules (#4503) * [cli] correctly detect URL of git submodules * Update components/gitpod-cli/cmd/credential-helper.go Co-authored-by: Cornelius A. Ludmann Co-authored-by: Cornelius A. Ludmann --- components/gitpod-cli/cmd/credential-helper.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/gitpod-cli/cmd/credential-helper.go b/components/gitpod-cli/cmd/credential-helper.go index c1acc304ddacd1..08f823c84fa467 100644 --- a/components/gitpod-cli/cmd/credential-helper.go +++ b/components/gitpod-cli/cmd/credential-helper.go @@ -148,7 +148,7 @@ func parseHostFromStdin() string { func parseProcessTree() (repoUrl string, gitCommand string) { gitCommandRegExp := regexp.MustCompile(`git(,\d+\s+|\s+)(push|clone|fetch|pull|diff)`) - repoUrlRegExp := regexp.MustCompile(`\sorigin\s*(https:.*\.git)\s`) + repoUrlRegExp := regexp.MustCompile(`\sorigin\s*(https:[^\s]*)\s`) pid := os.Getpid() for { cmdLine := readProc(pid, "cmdline") @@ -166,6 +166,9 @@ func parseProcessTree() (repoUrl string, gitCommand string) { match := repoUrlRegExp.FindStringSubmatch(cmdLineString) if len(match) == 2 { repoUrl = match[1] + if !strings.HasSuffix(repoUrl, ".git") { + repoUrl = repoUrl + ".git" + } } } if repoUrl != "" && gitCommand != "" {