github.com/StackExchange/blackbox/v2@v2.0.1-0.20220331193400-d84e904973ab/pkg/vcs/none/none.go (about) 1 package none 2 3 import ( 4 "fmt" 5 6 "github.com/StackExchange/blackbox/v2/pkg/commitlater" 7 "github.com/StackExchange/blackbox/v2/pkg/vcs" 8 ) 9 10 var pluginName = "NONE" 11 12 func init() { 13 vcs.Register(pluginName, 0, newNone) 14 } 15 16 // VcsHandle is 17 type VcsHandle struct { 18 repoRoot string 19 } 20 21 func newNone() (vcs.Vcs, error) { 22 return &VcsHandle{}, nil 23 } 24 25 // Name returns my name. 26 func (v VcsHandle) Name() string { 27 return pluginName 28 } 29 30 // Discover returns true if we are a repo of this type; along with the Abs path to the repo root (or "" if we don't know). 31 func (v VcsHandle) Discover() (bool, string) { 32 return true, "" // We don't know the root. 33 } 34 35 //// SetRepoRoot informs the Vcs of the VCS root. 36 //func (v *VcsHandle) SetRepoRoot(dir string) { 37 // v.repoRoot = dir 38 //} 39 40 // SetFileTypeUnix informs the VCS that files should maintain unix-style line endings. 41 func (v VcsHandle) SetFileTypeUnix(repobasedir string, files ...string) error { 42 return nil 43 } 44 45 // IgnoreAnywhere tells the VCS to ignore these files anywhere in the repo. 46 func (v VcsHandle) IgnoreAnywhere(repobasedir string, files []string) error { 47 return nil 48 } 49 50 // IgnoreFiles tells the VCS to ignore these files anywhere in the repo. 51 func (v VcsHandle) IgnoreFiles(repobasedir string, files []string) error { 52 return nil 53 } 54 55 // CommitTitle sets the title of the next commit. 56 func (v VcsHandle) CommitTitle(title string) {} 57 58 // NeedsCommit queues up commits for later execution. 59 func (v VcsHandle) NeedsCommit(message string, repobasedir string, names []string) { 60 return 61 } 62 63 // DebugCommits dumps a list of future commits. 64 func (v VcsHandle) DebugCommits() commitlater.List { 65 return commitlater.List{} 66 } 67 68 // FlushCommits informs the VCS to do queued up commits. 69 func (v VcsHandle) FlushCommits() error { 70 return nil 71 } 72 73 // The following are "secret" functions only used by the integration testing system. 74 75 // TestingInitRepo initializes a repo. 76 func (v VcsHandle) TestingInitRepo() error { 77 fmt.Println("VCS=none, TestingInitRepo") 78 return nil 79 }