{"thread":{"id":"12661","subject":"Whitespace on commit","startedAt":"2008-03-13T03:38:26Z","lastAt":"2008-03-13T07:34:40Z","messageCount":3,"participants":["Kenneth P. Turvey","Junio C Hamano","Andreas Ericsson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"71887","messageId":"fra7ji$7p9$1@ger.gmane.org","threadId":"12661","inReplyTo":null,"subject":"Whitespace on commit","fromName":"Kenneth P. Turvey","fromEmail":"kt-usenet@squeakydolphin.com","sentAt":"2008-03-13T03:38:26Z","receivedAt":"2008-03-13T03:38:26Z","isPatch":false,"sender":{"key":"kt-usenet@squeakydolphin.com","avatar":null},"body":"I keep getting annoying errors when I try to commit.  Git complains that I\nhave whitespace in the wrong places.  \n\nThis is fine.. I even like it.  What I don't like is having to change this\nstuff manually.  Is there anyway to tell git to just fix the stuff and do\nthe commit?  \n\nI've tried setting\n\napply.whitespace = fix \n\nin my .gitconfig, but that doesn't seem to help when doing commits.  Is\nthere another way to handle this? \n\nThanks!\n\n-- \nKenneth P. Turvey <kt-usenet@squeakydolphin.com>\n"},{"id":"71888","messageId":"7viqzr1dsp.fsf@gitster.siamese.dyndns.org","threadId":"12661","inReplyTo":"fra7ji$7p9$1@ger.gmane.org","subject":"Re: Whitespace on commit","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-13T03:52:06Z","receivedAt":"2008-03-13T03:52:06Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Kenneth P. Turvey\" <kt-usenet@squeakydolphin.com> writes:\n\n> I keep getting annoying errors when I try to commit.  Git complains that I\n> have whitespace in the wrong places.  \n>\n> This is fine.. I even like it.  What I don't like is having to change this\n> stuff manually.  Is there anyway to tell git to just fix the stuff and do\n> the commit?  \n>\n> I've tried setting\n>\n> apply.whitespace = fix \n>\n> in my .gitconfig, but that doesn't seem to help when doing commits.\n\nYeah, that is to protect yourself from whitespace mess _other people_\nthrew at you in a patch form.\n\nYou can ask git to fix your own stuff up, by pretending that you are that\nother person who made the mess, by doing:\n\n\tgit diff HEAD >P.diff\n        git reset --hard HEAD\n        git apply --index --whitespace=fix P.diff\n"},{"id":"71903","messageId":"47D8D910.5060901@op5.se","threadId":"12661","inReplyTo":"7viqzr1dsp.fsf@gitster.siamese.dyndns.org","subject":"Re: Whitespace on commit","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2008-03-13T07:34:40Z","receivedAt":"2008-03-13T07:34:40Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> \"Kenneth P. Turvey\" <kt-usenet@squeakydolphin.com> writes:\n> \n>> I keep getting annoying errors when I try to commit.  Git complains that I\n>> have whitespace in the wrong places.  \n>>\n>> This is fine.. I even like it.  What I don't like is having to change this\n>> stuff manually.  Is there anyway to tell git to just fix the stuff and do\n>> the commit?  \n>>\n>> I've tried setting\n>>\n>> apply.whitespace = fix \n>>\n>> in my .gitconfig, but that doesn't seem to help when doing commits.\n> \n> Yeah, that is to protect yourself from whitespace mess _other people_\n> threw at you in a patch form.\n> \n> You can ask git to fix your own stuff up, by pretending that you are that\n> other person who made the mess, by doing:\n> \n> \tgit diff HEAD >P.diff\n>         git reset --hard HEAD\n>         git apply --index --whitespace=fix P.diff\n> \n\nI have exactly that (except my P.diff sits in /tmp under a different name)\nas an alias named wsfix. Here's how to make one of your own, Kenneth:\n\ngit config --global alias wsfix '!git diff HEAD >P.diff && git reset --hard HEAD && git apply --index --whitespace=fix P.diff && rm -f P.diff'\n\nNote that there are no newlines in the above command. When you get the whitespace\nwarnings, just run \"git wsfix\" and you'll be good to go.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"}]}