Skip to content

Commit

Permalink
Update expected Azure repository format (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMagee authored Jan 3, 2024
1 parent a104d64 commit dc33234
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions internal/model/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ type AzureRepo struct {
}

// NewAzureRepo parses a repo string and returns an AzureRepo struct
// Expects a repo string in the format org/project/repo
// Expects a repo string in the format org/project/_git/repo
func NewAzureRepo(packageManager string, repo string, directory string) *AzureRepo {
repoParts := strings.Split(repo, "/")
for i, part := range repoParts {
println(i, part)
}
if len(repoParts) != 3 {
if len(repoParts) != 4 {
return nil
}

return &AzureRepo{
PackageManger: packageManager,
Org: repoParts[0],
Project: repoParts[1],
Repo: repoParts[2],
Repo: repoParts[3],
Directory: directory,
}
}
2 changes: 1 addition & 1 deletion internal/model/azure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func Test_NewAzureRepo(t *testing.T) {
{
name: "valid repo",
packageManager: "npm_and_yarn",
repo: "my-org/my-project/my-repo",
repo: "my-org/my-project/_git/my-repo",
directory: "/",
expected: &AzureRepo{
PackageManger: "npm_and_yarn",
Expand Down

0 comments on commit dc33234

Please sign in to comment.