Skip to content

Commit 34b5b5f

Browse files
authored
fix: exclude git commands to prevent weird errors (#3)
1 parent 5f8ca82 commit 34b5b5f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

main.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,19 @@ func main() {
131131
return
132132
}
133133

134+
// NOTE: exclude git commands to prevent weird errors
135+
// _git:8182: bad math expression: operand expected at `/home/user/...'
136+
// _git:8182: bad math expression: operand expected at `/home/user/...'
137+
// _git:8182: math recursion limit exceeded: name-rev
138+
// _git:8182: bad math expression: operator expected at `browse'
139+
if cmdName == "git" || strings.HasPrefix(cmdName, "git-") {
140+
if isVerbose {
141+
fmt.Printf("skipped git command: %s\n", fileName)
142+
}
143+
skippedNum++
144+
return
145+
}
146+
134147
srcFilePath := filepath.Join(srcDir, fileName)
135148
srcFile, err := os.Open(filepath.Join(srcFilePath))
136149
if err != nil {

0 commit comments

Comments
 (0)