Skip to content

Commit

Permalink
Merge pull request #111 from garethjevans/bug-on-rebas
Browse files Browse the repository at this point in the history
chore: fix on rebase when remote endswith .git
  • Loading branch information
cagiti authored Feb 3, 2021
2 parents f171973 + 10d5205 commit b6a92aa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/domain/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ func ExtractURLFromRemote(reader io.Reader, name string) (string, error) {
}

func ExtractOrgAndRepoURL(urlString string) (string, string, error) {
if strings.HasSuffix(urlString, ".git") {
urlString = strings.TrimSuffix(urlString, ".git")
}
url, err := url2.Parse(urlString)
if err != nil {
return "", "", err
Expand Down
16 changes: 16 additions & 0 deletions pkg/domain/rebase_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,22 @@ upstream https://github.com/upstream/repo (push)`,
"https://api.github.com/repos/upstream/repo",
},
},
{
name: "simple rebase on main with .git extension",
remotes: `origin https://github.com/origin/clone.git (fetch)
origin https://github.com/origin/clone.git (push)`,
originDefaultBranch: "main",
expectedCommands: []string{
"git remote -v",
"git remote -v",
"git status --porcelain",
"git branch --show-current",
"git pull --tags origin main",
},
expectedRequests: []string{
"https://api.github.com/repos/origin/clone",
},
},
}

for _, tc := range tests {
Expand Down

0 comments on commit b6a92aa

Please sign in to comment.