I have to apply a patch to my repo and am running
git apply --directory=$PWD xxxxx.patch
For reasons I won't go into, I cannot use git am
in this instance, and I need to use the directory flag.
git tells me:
$> git apply --directory=$PWD xxxxx.patch
code1/xxxxx.patch:337: trailing whitespace.
< one partial line of code >
warning: 1 line adds whitespace errors.
I have read that the whitespace warning is nothing serious and should not stop git from applying the patch. However, whatever the reason, git is not applying the patch. None of the current files in the repo are changing. Any idea what to do about this?
I note the following boldfaced (my boldface) sentence in the git apply
documentation:
Reads the supplied diff output (i.e. "a patch") and applies it to files. When running from a subdirectory in a repository, patched paths outside the directory are ignored. With the
--index
option ...
It seems in this case that git patch
is deciding that the files are outside the directory. If run from the top level, it should stop deciding that (though of course $PWD
itself will change too; any --directory
option, if one is required, would need a different argument).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With