bug-patch
[Top][All Lists]
Advanced

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

[bug-patch] Incorrect error when applying git-created patch


From: Tim Waugh
Subject: [bug-patch] Incorrect error when applying git-created patch
Date: Mon, 11 Aug 2014 17:30:49 +0100

When applying a patch from git that removes a binary file, patch
complains and gives a non-zero exit code.

For example:

$ mkdir a
$ cd a
$ git init
Initialized empty Git repository in /tmp/a/.git/
$ cp /usr/share/icons/gnome/16x16/actions/add.png add.png
$ git add add.png
$ git commit -m "Add binary file."
[master (root-commit) b4c29b0] Add binary file.
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 add.png
$ git rm -f add.png
rm 'add.png'
$ git commit -m "Remove binary file."
[master c0037af] Remove binary file.
 1 file changed, 0 insertions(+), 0 deletions(-)
 delete mode 100644 add.png
$ cp /usr/share/icons/gnome/16x16/actions/add.png add.png
$ git show | patch
patching file add.png
File add.png is not empty after patch; not deleting
$ echo $?
1
$ wc -c add.png
520 add.png

The input patch looks like this:

commit c0037af7ae54076ec529163bedf92c0ed3a5af58
Author: Tim Waugh <address@hidden>
Date:   Mon Aug 11 17:27:44 2014 +0100

    Remove binary file.

diff --git a/add.png b/add.png
deleted file mode 100644
index 3f1347e..0000000
Binary files a/add.png and /dev/null differ

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.

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

Tim.
*/

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]