mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 00:52:55 +00:00
Refactor changeset spanning function naming
This commit is contained in:
@@ -235,7 +235,7 @@ func PullRequestSpanningPathList(repository GitHubService, pullrequest int, path
|
|||||||
|
|
||||||
spanningChangesExist := false
|
spanningChangesExist := false
|
||||||
for _, changeset := range changesets {
|
for _, changeset := range changesets {
|
||||||
if ChangesetSpanningPathList(changeset, paths) {
|
if changeset.isSpanningPaths(paths) {
|
||||||
// When detecting the first spanning changeset print a prefix message
|
// When detecting the first spanning changeset print a prefix message
|
||||||
if !spanningChangesExist {
|
if !spanningChangesExist {
|
||||||
fmt.Printf("Spanning changesets detected in the following commits:\n\n")
|
fmt.Printf("Spanning changesets detected in the following commits:\n\n")
|
||||||
@@ -250,9 +250,9 @@ func PullRequestSpanningPathList(repository GitHubService, pullrequest int, path
|
|||||||
return spanningChangesExist, changesets, nil
|
return spanningChangesExist, changesets, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChangesetSpanningPathList tests if a changeset is spanning
|
// isSpanningPaths tests if a changeset is spanning
|
||||||
// multiple directory paths.
|
// multiple directory paths.
|
||||||
func ChangesetSpanningPathList(changeset *Changeset, paths []string) bool {
|
func (changeset *Changeset) isSpanningPaths(paths []string) bool {
|
||||||
matchedPath := ""
|
matchedPath := ""
|
||||||
|
|
||||||
for _, file := range changeset.files {
|
for _, file := range changeset.files {
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ func TestIsChangesetSpanning(t *testing.T) {
|
|||||||
|
|
||||||
changeset := &Changeset{files: tt.changeset}
|
changeset := &Changeset{files: tt.changeset}
|
||||||
|
|
||||||
result := ChangesetSpanningPathList(changeset, tt.files)
|
result := changeset.isSpanningPaths(tt.files)
|
||||||
|
|
||||||
if result != tt.expected {
|
if result != tt.expected {
|
||||||
t.Errorf("got %t, want %t", result, tt.expected)
|
t.Errorf("got %t, want %t", result, tt.expected)
|
||||||
|
|||||||
Reference in New Issue
Block a user