Browse files

Revised to work inside of a git repository

Exclude git system files and folders from the list of processed files to
avoid corruption of the repository when removing trailing whitespace.
  • Loading branch information...
dregad committed Sep 12, 2012
1 parent 657f984 commit 5a7744dc48d6585fc056b25fcb64f42cbe872c3c
Showing with 2 additions and 2 deletions.
  1. +2 −2
@@ -43,11 +43,11 @@ rm -r $TO_DELETE
echo "Converting line endings to Unix format"
-find . -type f -print0 |xargs -0 dos2unix
+find . -type f ! -path "./.git*" -print0 |xargs -0 dos2unix
echo "Removing trailing whitespace"
-find . -type f -print0 |xargs -0 sed -i.bak -e 's/[ \t]*$//'
+find . -type f ! -path "./.git*" -print0 |xargs -0 sed -i.bak -e 's/[ \t]*$//'
# Removing backup files if sed execution successful
if [ $? -eq 0 ]

0 comments on commit 5a7744d

Please sign in to comment.