jish / pre-commit

A slightly improved pre-commit hook for git
https://jish.github.io/pre-commit/
Other
796 stars 96 forks source link

Fix grep version detection on busybox / alpine #268

Closed fgrehm closed 6 years ago

fgrehm commented 6 years ago

@jish this is a follow up of GH-265 and GH-266, I was getting these errors on latest release:

$ git ci
grep: unrecognized option: version
BusyBox v1.26.2 (2017-11-23 08:40:54 GMT) multi-call binary.

Usage: grep [-HhnlLoqvsriwFE] [-m N] [-A/B/C N] PATTERN/-e PATTERN.../-f FILE [FILE]...

Search for PATTERN in FILEs (or stdin)

        -H      Add 'filename:' prefix
        -h      Do not add 'filename:' prefix
        -n      Add 'line_no:' prefix
        -l      Show only names of files that match
        -L      Show only names of files that don't match
        -c      Show only count of matching lines
        -o      Show only the matching part of line
        -q      Quiet. Return 0 if PATTERN is found, 1 otherwise
        -v      Select non-matching lines
        -s      Suppress open and read errors
        -r      Recurse
        -i      Ignore case
        -w      Match whole words only
        -x      Match whole lines only
        -F      PATTERN is a literal (not regexp)
        -E      PATTERN is an extended regexp
        -m N    Match up to N times per file
        -A N    Print N lines of trailing context
        -B N    Print N lines of leading context
        -C N    Same as '-A N -B N'
        -e PTRN Pattern to match
        -f FILE Read pattern from file
/usr/local/bundle/gems/pre-commit-0.38.0/lib/pre-commit/checks/grep.rb:98:in `readline': end of file reached (EOFError)
        from /usr/local/bundle/gems/pre-commit-0.38.0/lib/pre-commit/checks/grep.rb:98:in `block in detect_grep_version'
        from /usr/local/lib/ruby/2.4.0/open3.rb:205:in `popen_run'
        from /usr/local/lib/ruby/2.4.0/open3.rb:147:in `popen2'
        from /usr/local/bundle/gems/pre-commit-0.38.0/lib/pre-commit/checks/grep.rb:96:in `detect_grep_version'
        from /usr/local/bundle/gems/pre-commit-0.38.0/lib/pre-commit/checks/grep.rb:87:in `grep'
        from /usr/local/bundle/gems/pre-commit-0.38.0/lib/pre-commit/checks/grep.rb:54:in `block in call'
coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.002%) to 97.329% when pulling 167dd71df9c18054a0cc6926f7af2690fd7518b6 on fgrehm:fix-version-ignore into d6dcaf8c1ebe9f5f1af885a8157375141ff22afc on jish:master.

jish commented 6 years ago

Thanks!

jish commented 6 years ago

Released version 0.38.1 https://rubygems.org/gems/pre-commit