Skip to content

Commit

Permalink
.gitattributes: Mark minified javascript as binary to filter greps
Browse files Browse the repository at this point in the history
When doing a git grep (of rustc-dev-guide or of rust-lang/rust with
--recurse-submodules), if the grep happens to match within the minified
javascript, the resulting long single lines can cause a text pager or
editor to slow down and distract from more useful matches.

Minified javascript isn't formatted for human consumption, by
definition, so mark it as binary, which causes git grep to instead just
state that it matches without printing the matching "line".
  • Loading branch information
joshtriplett authored and tshepang committed Oct 7, 2022
1 parent 0932ad6 commit 9a86c04
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto eol=lf

# git grep shouldn't match entries in huge minified javascript
*.min.js binary

# Older git versions try to fix line endings on images, this prevents it.
*.png binary
*.jpg binary
Expand Down

0 comments on commit 9a86c04

Please sign in to comment.