Skip to content

Commit

Permalink
update to use the full path
Browse files Browse the repository at this point in the history
  • Loading branch information
owenrumney-f3 committed Feb 12, 2021
1 parent 1ceed83 commit 7774b34
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions internal/app/squealer/scan/git_scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ import (
)

type CommitFile struct {
commit *object.Commit
file *object.File
commit *object.Commit
file *object.File
changePath string
}

type gitScanner struct {
Expand Down Expand Up @@ -132,7 +133,7 @@ func (s *gitScanner) processCommit(commit *object.Commit, ch chan CommitFile) er
return err
}
err = files.ForEach(func(file *object.File) error {
ch <- CommitFile{commit, file}
ch <- CommitFile{commit, file, ""}
return nil
})
return err
Expand Down Expand Up @@ -169,7 +170,7 @@ func (s *gitScanner) processCommit(commit *object.Commit, ch chan CommitFile) er
continue
}

ch <- CommitFile{commit, toFile}
ch <- CommitFile{commit, toFile, change.To.Name}
}

return nil
Expand All @@ -195,15 +196,15 @@ func (s *gitScanner) processFile(cf CommitFile) error {
if isBin, err := file.IsBinary(); err != nil || isBin {
return nil
}
if shouldIgnore(file.Name, s.ignorePaths, s.ignoreExtensions) {
if shouldIgnore(cf.changePath, s.ignorePaths, s.ignoreExtensions) {
return nil
}
content, err := file.Contents()
if err != nil {
return err
}

err = s.mc.Evaluate(file.Name, content, cf.commit)
err = s.mc.Evaluate(cf.changePath, content, cf.commit)
s.metrics.IncrementFilesProcessed()
return err
}
Expand Down

0 comments on commit 7774b34

Please sign in to comment.