Tim,

2014-08-11 18:30 GMT+02:00 Tim Waugh <twa...@redhat.com>:
> When applying a patch from git that removes a binary file, patch
> complains and gives a non-zero exit code.
>
> [...]
> Because of 'diff --git' and 'deleted file mode', patch rightly thinks
> this patch intends to delete that file. However, it doesn't actually
> delete it because it's a binary file so doesn't see any changes to make.

Right, patch is conservative and only deletes files when the file contents
match what's in the patch. Git does the same:

$ git show | git apply
error: cannot apply binary patch to 'add.png' without full index line
error: add.png: patch does not apply

With a binary patch, it succeeds:

$ git show --binary | git apply

Patch doesn't currently support git binary patches, it only recognizes them.

> Shouldn't it just delete the file in this instance?

The current behavior seems reasonable to me -- better safe than sorry.
The message could be improved though.

What do you think?

Thanks,
Andreas

Reply via email to