File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 11package todos
22
33import (
4+ "bufio"
45 "context"
56 "fmt"
67 "regexp"
@@ -116,12 +117,23 @@ func (t *ToDo) existsInCommit(commit *object.Commit) (bool, error) {
116117 }
117118 return false , err
118119 }
119- c , err := f .Contents ()
120+ r , err := f .Reader ()
120121 if err != nil {
121122 return false , err
122123 }
123- contains := strings .Contains (c , t .Comment .String ())
124- return contains , nil
124+ defer r .Close ()
125+ s := bufio .NewScanner (r )
126+ for s .Scan () {
127+ line := s .Text ()
128+ if strings .Contains (line , t .Comment .String ()) {
129+ return true , nil
130+ }
131+ }
132+ err = s .Err ()
133+ if err != nil {
134+ return false , err
135+ }
136+ return false , nil
125137}
126138
127139// FindBlame sets the blame information on each todo in a set of todos
You can’t perform that action at this time.
0 commit comments