@@ -19,17 +19,9 @@ const (
1919 Name = "vcs/gitrepo"
2020)
2121
22- type Config struct {
23- IncludeRootGit bool
24- Disabled bool
25- }
26-
2722// Extractor extracts git repository hashes including submodule hashes.
2823// This extractor will not return an error, and will just return no results if we fail to extract
29- type Extractor struct {
30- IncludeRootGit bool
31- Disabled bool
32- }
24+ type Extractor struct {}
3325
3426func getCommitSHA (repo * git.Repository ) (string , error ) {
3527 head , err := repo .Head ()
@@ -89,10 +81,6 @@ func (e *Extractor) Requirements() *plugin.Capabilities {
8981
9082// FileRequired returns true for git repositories .git dirs
9183func (e * Extractor ) FileRequired (fapi filesystem.FileAPI ) bool {
92- if e .Disabled {
93- return false
94- }
95-
9684 if filepath .Base (fapi .Path ()) != ".git" {
9785 return false
9886 }
@@ -108,11 +96,6 @@ func (e *Extractor) FileRequired(fapi filesystem.FileAPI) bool {
10896
10997// Extract extracts git commits from HEAD and from submodules
11098func (e * Extractor ) Extract (_ context.Context , input * filesystem.ScanInput ) (inventory.Inventory , error ) {
111- // todo: maybe we should return an error instead? need to double check we're always using FileRequired correctly first
112- if e .Disabled {
113- return inventory.Inventory {}, nil
114- }
115-
11699 // The input path is the .git directory, but git.PlainOpen expects the actual directory containing the .git dir.
117100 // So call filepath.Dir to get the parent path
118101 // Assume this is fully on a real filesystem
@@ -124,14 +107,12 @@ func (e *Extractor) Extract(_ context.Context, input *filesystem.ScanInput) (inv
124107
125108 var inv inventory.Inventory
126109
127- if e .IncludeRootGit {
128- commitSHA , err := getCommitSHA (repo )
110+ commitSHA , err := getCommitSHA (repo )
129111
130- // If error is not nil, then ignore this and continue, as it is not fatal.
131- // The error could be because there are no commits in the repository
132- if err == nil {
133- inv .Packages = append (inv .Packages , createCommitQueryInventory (commitSHA , input .Path ))
134- }
112+ // If error is not nil, then ignore this and continue, as it is not fatal.
113+ // The error could be because there are no commits in the repository
114+ if err == nil {
115+ inv .Packages = append (inv .Packages , createCommitQueryInventory (commitSHA , input .Path ))
135116 }
136117
137118 // If we can't get submodules, just return with what we have.
@@ -159,22 +140,3 @@ func (e *Extractor) Ecosystem(_ *extractor.Package) string {
159140}
160141
161142var _ filesystem.Extractor = & Extractor {}
162-
163- type configurable interface {
164- Configure (config Config )
165- }
166-
167- func (e * Extractor ) Configure (config Config ) {
168- e .IncludeRootGit = config .IncludeRootGit
169- e .Disabled = config .Disabled
170- }
171-
172- var _ configurable = & Extractor {}
173-
174- func Configure (plug plugin.Plugin , config Config ) {
175- us , ok := plug .(configurable )
176-
177- if ok {
178- us .Configure (config )
179- }
180- }
0 commit comments