apply --cached --whitespace=fix now failing on items added with "add -N"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

$ git --version
git version 2.4.3.573.g4eafbef
$ uname -a
Linux <redacted> 3.13.0-53-generic #89-Ubuntu SMP Wed May 20 10:34:39
UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
--
To unsubscribe from this list: send the line "unsubscribe git" in



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]