Skip to content
Prev Previous commit
Next Next commit
update function name to make more sense
  • Loading branch information
ecrupper committed Sep 29, 2022
commit e4b68ae5201d32c04e843fdc193b03f71833f6da
2 changes: 1 addition & 1 deletion api/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func CreateSecret(c *gin.Context) {
// retrieve org and repo name from SCM
//
// same story as org secret. SCM has accurate casing.
scmOrg, scmRepo, err := scm.FromContext(c).GetRepoName(u, o, n)
scmOrg, scmRepo, err := scm.FromContext(c).GetOrgAndRepoName(u, o, n)
if err != nil {
retErr := fmt.Errorf("unable to retrieve repository %s/%s", o, n)

Expand Down
2 changes: 1 addition & 1 deletion scm/github/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ func (c *client) GetRepo(u *library.User, r *library.Repo) (*library.Repo, error
}

// GetRepoName returns the name of the repository in the SCM.
func (c *client) GetRepoName(u *library.User, o string, r string) (string, string, error) {
func (c *client) GetOrgAndRepoName(u *library.User, o string, r string) (string, string, error) {
c.Logger.WithFields(logrus.Fields{
"org": o,
"repo": r,
Expand Down
4 changes: 2 additions & 2 deletions scm/github/repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@ func TestGithub_GetRepoName(t *testing.T) {
client, _ := NewTest(s.URL)

// run test
gotOrg, gotRepo, err := client.GetRepoName(u, "octocat", "Hello-World")
gotOrg, gotRepo, err := client.GetOrgAndRepoName(u, "octocat", "Hello-World")

if resp.Code != http.StatusOK {
t.Errorf("GetRepoName returned %v, want %v", resp.Code, http.StatusOK)
Expand Down Expand Up @@ -1084,7 +1084,7 @@ func TestGithub_GetRepoName_Fail(t *testing.T) {
client, _ := NewTest(s.URL)

// run test
_, _, err := client.GetRepoName(u, "octocat", "Hello-World")
_, _, err := client.GetOrgAndRepoName(u, "octocat", "Hello-World")

if err == nil {
t.Error("GetRepoName should return error")
Expand Down
2 changes: 1 addition & 1 deletion scm/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ type Service interface {
GetRepo(*library.User, *library.Repo) (*library.Repo, error)
// GetRepoName defines a function that retrieves
// the name of the repo in the SCM.
GetRepoName(*library.User, string, string) (string, string, error)
GetOrgAndRepoName(*library.User, string, string) (string, string, error)
// GetOrg defines a function that retrieves
// the name for an org in the SCM.
GetOrgName(*library.User, string) (string, error)
Expand Down