Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SUP-1912 Support git worktrees #224

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pipelines
package pipeline

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pipelines
package pipeline

import (
"os"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pipelines
package pipeline

import (
"strings"
Expand All @@ -8,7 +8,6 @@ import (
)

func ResolveFromPath(path string, org string, client *buildkite.Client) ([]string, error) {

repos, err := getRepoURLs(path)
if err != nil {
return nil, err
Expand All @@ -17,7 +16,6 @@ func ResolveFromPath(path string, org string, client *buildkite.Client) ([]strin
}

func filterPipelines(repoURLs []string, org string, client *buildkite.Client) ([]string, error) {

var currentPipelines []string
page := 1
per_page := 30
Expand All @@ -38,7 +36,6 @@ func filterPipelines(repoURLs []string, org string, client *buildkite.Client) ([
gitUrl := u[strings.LastIndex(u, "/")+1:]
if strings.Contains(*p.Repository, gitUrl) {
currentPipelines = append(currentPipelines, *p.Slug)

}
}
}
Expand All @@ -56,7 +53,7 @@ func getRepoURLs(path string) ([]string, error) {
if len(path) > 0 {
searchPath = path
}
r, err := git.PlainOpenWithOptions(searchPath, &git.PlainOpenOptions{DetectDotGit: true})
r, err := git.PlainOpenWithOptions(searchPath, &git.PlainOpenOptions{DetectDotGit: true, EnableDotGitCommonDir: true})
if err != nil {
return nil, err
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pipelines
package pipeline

import (
"net/http"
Expand Down
7 changes: 7 additions & 0 deletions internal/pipeline/pipeline.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package pipeline

// Pipeline is a struct containing information about a pipeline for a resolver to return
type Pipeline struct {
Name string
Org string
}
6 changes: 0 additions & 6 deletions internal/pipeline/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ package pipeline

import "errors"

// Pipeline is a struct containing information about a pipeline for a resolver to return
type Pipeline struct {
Name string
Org string
}

// PipelineResolverFn is a function for the purpose of finding a pipeline. It returns an error if an irrecoverable
// scenario happens and should halt execution. Otherwise if the resolver does not find a pipeline, it should return
// (nil, nil) to indicate this. ie. no error occurred, but no pipeline was found either.
Expand Down