Skip to content

Commit

Permalink
fix: PaC not working with dot git suffixed url
Browse files Browse the repository at this point in the history
Signed-off-by: Matej Vasek <mvasek@redhat.com>
  • Loading branch information
matejvasek committed Apr 28, 2023
1 parent cd0dbfd commit 6c81499
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,7 @@ func RepoOwnerAndNameFromUrl(url string) (string, string, error) {
repoOwner := repoArr[0]
repoName := repoArr[1]

repoName = strings.TrimSuffix(repoName, ".git")

return repoOwner, repoName, nil
}
7 changes: 7 additions & 0 deletions pkg/git/git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ func TestGetRepoOwnerFromGHURL(t *testing.T) {
wantName: "bar",
wantErr: false,
},
{
name: "correct with dot git suffix",
url: "https://gh/foo/bar.git",
wantOwner: "foo",
wantName: "bar",
wantErr: false,
},
{
name: "correct with capital letters",
url: "https://gh/FOO/bar",
Expand Down

0 comments on commit 6c81499

Please sign in to comment.