Skip to content

Commit

Permalink
Add script for removing trailing whitespace
Browse files Browse the repository at this point in the history
This solution was suggested by @akaihola, and it is from a gist by
@dpaluy.  Originally from stack exchange (see the script for a link to
the gist and the discussion).

Closes python#408.
  • Loading branch information
JukkaL committed Sep 22, 2014
1 parent 3976964 commit c15ba23
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions misc/remove-eol-whitespace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

# Remove trailing whitespace from all non-binary files in a git repo.

# From https://gist.github.com/dpaluy/3690668; originally from here:
# http://unix.stackexchange.com/questions/36233/how-to-skip-file-in-sed-if-it-contains-regex/36240#36240

git grep -I --name-only -z -e '' | xargs -0 sed -i -e 's/[ \t]\+\(\r\?\)$/\1/'

0 comments on commit c15ba23

Please sign in to comment.