Skip to content

Commit

Permalink
[cli] correctly detect URL of git submodules (#4503)
Browse files Browse the repository at this point in the history
* [cli] correctly detect URL of git submodules

* Update components/gitpod-cli/cmd/credential-helper.go

Co-authored-by: Cornelius A. Ludmann <[email protected]>

Co-authored-by: Cornelius A. Ludmann <[email protected]>
  • Loading branch information
JanKoehnlein and corneliusludmann authored Jun 15, 2021
1 parent f77a2e3 commit 4cb9104
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/gitpod-cli/cmd/credential-helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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 != "" {
Expand Down

0 comments on commit 4cb9104

Please sign in to comment.