Re: git add without whitespace

2016-05-31 Thread demerphq
On 30 May 2016 at 21:06, Junio C Hamano wrote: > Robert Dailey writes: > >> $ git diff -U0 -w --no-color | git apply --cached --ignore-whitespace >> --unidiff-zero >> >> This command explicitly leaves out context because it can sometimes >> cause the

Re: git add without whitespace

2016-05-31 Thread Junio C Hamano
Robert Dailey writes: > - Splitting whitespace & real changes to two commits is probably > superfluous; my original goal was to make diffing the actual changes > easier, but since 'git diff -w' exists this is moot. Doing "whitespace clean-up" in a separate preparatory

Re: git add without whitespace

2016-05-31 Thread Christian Neukirchen
Junio C Hamano writes: > Robert Dailey writes: > >> $ git diff -U0 -w --no-color | git apply --cached --ignore-whitespace >> --unidiff-zero >> >> This command explicitly leaves out context because it can sometimes >> cause the patch to fail to apply,

Re: git add without whitespace

2016-05-30 Thread Junio C Hamano
Robert Dailey writes: > I like your solution better than mine because it utilizes the rules > defined in .gitattributes. A difference that may be more important is that I do not do generation of a patch or application of it without ignoring whitespaces with things like

Re: git add without whitespace

2016-05-30 Thread Robert Dailey
On Mon, May 30, 2016 at 2:06 PM, Junio C Hamano wrote: > I have had this in my ~/.gitconfig for a long time. > > [alias] > wsadd = "!sh -c 'git diff -- \"$@\" | git apply --cached > --whitespace=fix;\ > git co -- ${1-.} \"$@\"' -" > > That is, "take

Re: git add without whitespace

2016-05-30 Thread Junio C Hamano
Robert Dailey writes: > $ git diff -U0 -w --no-color | git apply --cached --ignore-whitespace > --unidiff-zero > > This command explicitly leaves out context because it can sometimes > cause the patch to fail to apply, I think due to whitespace being in > it, but I'm

git add without whitespace

2016-05-30 Thread Robert Dailey
I think it would be useful to have a '-w' option for 'git add' that completely ignores whitespace changes, the same way that 'git diff -w' does. Real life scenario: Sometimes developers will use tooling that does not properly strip trailing whitespace in source files. Next time I edit those