We Recommend

bash Cookbook: Solutions and Examples for bash Users bash Cookbook: Solutions and Examples for bash Users
bash Cookbook teaches shell scripting the way Unix masters practice the craft. It presents a variety of recipes and tricks for all levels of shell programmers so that anyone can become a proficient user of the most common Unix shell -- the bash shell -- and cygwin or other popular Unix emulation packages.


Posted By

benpjohnson on 09/15/08


Tagged

Bash windows git


Versions (?)


Git whitespace fixes for windows newlines


Published in: Bash 


Pre 1.6 git has some annoying whitespace checking in it's pre-commit hook. Rather than turn it off I decided to have a go at an automated method to fix the issue.

Running the first line lists the files that have problems. The second just adds a sed to fix the issue

  1. .git/hooks/pre-commit 2>&1 | sed '/^\*/d' | sed 's/:.*//' | uniq
  2.  
  3. for FILE in `.git/hooks/pre-commit 2>&1 | sed '/^\*/d' | sed 's/:.*//' | uniq` ; do sed -ie 's/[[:space:]]*$//' $FILE ; done

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: benpjohnson on September 21, 2008

Doesn't really work for most issues had to disable it in the pre-commit hook file for time being

You need to login to post a comment.