On Mon, Jun 22, 2015 at 9:29 PM, Patrick Higgins <phiggins@xxxxxxxxxx> wrote: > I like to use git to remove trailing whitespace from my files. I use > the following ~/.gitconfig to make this convenient: > > [alias] > wsadd = "!sh -c 'git diff -- \"$@\" | git apply --cached > --whitespace=fix;\ > git checkout -- ${1-.} \"$@\"' -" > > The wsadd alias doesn't work with new files, so I have to use "git add > -N" on them first. As of a week or two ago, the "apply --cached" step > now fails with the following, assuming a new file named bar containing > "foo " has been added with "add -N": > > $ git diff -- "$@" | git apply --cached --whitespace=fix > <stdin>:7: trailing whitespace. > foo > error: bar: already exists in index > > The final "git checkout" at the end of wsadd truncates my file. I've > changed the ";" to a "&&" to fix the truncation. > > Were there any recent changes to "git apply" that might have caused this? Probably fallout from this one, merged to 'master' about 5 weeks ago. I'll have a look at it tomorrow unless somebody does it first d95d728 (diff-lib.c: adjust position of i-t-a entries in diff - 2015-03-16) -- Duy -- To unsubscribe from this list: send the line "unsubscribe git" in