From 085550a4051ea42b05e45ed3c51fd0fd2fe502a7 Mon Sep 17 00:00:00 2001 From: Jan Koehnlein Date: Mon, 14 Jun 2021 14:49:56 +0000 Subject: [PATCH 1/2] [cli] correctly detect URL of git submodules --- 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..046a50caf5efbb 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 != "" { From 3ff79f6df3085f6e1c36036cc4eba9b394dad050 Mon Sep 17 00:00:00 2001 From: Jan Koehnlein Date: Tue, 15 Jun 2021 09:50:13 +0200 Subject: [PATCH 2/2] Update components/gitpod-cli/cmd/credential-helper.go Co-authored-by: Cornelius A. Ludmann --- components/gitpod-cli/cmd/credential-helper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/gitpod-cli/cmd/credential-helper.go b/components/gitpod-cli/cmd/credential-helper.go index 046a50caf5efbb..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:[^s]*)\s`) + repoUrlRegExp := regexp.MustCompile(`\sorigin\s*(https:[^\s]*)\s`) pid := os.Getpid() for { cmdLine := readProc(pid, "cmdline")