summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7bbf88c)
raw | patch | inline | side by side (parent: 7bbf88c)
author | Junio C Hamano <junkio@cox.net> | |
Thu, 7 Sep 2006 05:45:21 +0000 (22:45 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 7 Sep 2006 09:44:40 +0000 (02:44 -0700) |
Historically we did not allow binary patch applied without an
explicit permission from the user, and this flag was the way to
do so. This makes the flag a no-op by always allowing binary
patch application.
Signed-off-by: Junio C Hamano <junkio@cox.net>
explicit permission from the user, and this flag was the way to
do so. This makes the flag a no-op by always allowing binary
patch application.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Documentation/git-apply.txt | patch | blob | history | |
builtin-apply.c | patch | blob | history | |
t/t4103-apply-binary.sh | patch | blob | history |
index c76cfffdc6cd9982aa02e34b2b09fc22897e7402..0a6f7b32192df8a8a2266b0d302271a62c612b1f 100644 (file)
deletion part but not addition part.
--allow-binary-replacement, --binary::
- When applying a patch, which is a git-enhanced patch
- that was prepared to record the pre- and post-image object
- name in full, and the path being patched exactly matches
- the object the patch applies to (i.e. "index" line's
- pre-image object name is what is in the working tree),
- and the post-image object is available in the object
- database, use the post-image object as the patch
- result. This allows binary files to be patched in a
- very limited way.
+ Historically we did not allow binary patch applied
+ without an explicit permission from the user, and this
+ flag was the way to do so. Currently we always allow binary
+ patch application, so this is a no-op.
--exclude=<path-pattern>::
Don't apply changes to files matching the given path pattern. This can
diff --git a/builtin-apply.c b/builtin-apply.c
index 872c8005a27c0085d47680a8e638b8cf6f3d70a3..6e0864ce27619d1153575876e2a617a392906aed 100644 (file)
--- a/builtin-apply.c
+++ b/builtin-apply.c
static int newfd = -1;
static int p_value = 1;
-static int allow_binary_replacement;
static int check_index;
static int write_index;
static int cached;
@@ -1228,14 +1227,12 @@ static int parse_chunk(char *buffer, unsigned long size, struct patch *patch)
}
}
- /* Empty patch cannot be applied if:
- * - it is a binary patch and we do not do binary_replace, or
- * - text patch without metadata change
+ /* Empty patch cannot be applied if it is a text patch
+ * without metadata change. A binary patch appears
+ * empty to us here.
*/
if ((apply || check) &&
- (patch->is_binary
- ? !allow_binary_replacement
- : !metadata_changes(patch)))
+ (!patch->is_binary && !metadata_changes(patch)))
die("patch with only garbage at line %d", linenr);
}
unsigned char hdr[50];
int hdrlen;
- if (!allow_binary_replacement)
- return error("cannot apply binary patch to '%s' "
- "without --allow-binary-replacement",
- name);
-
/* For safety, we require patch index line to contain
* full 40-byte textual SHA1 for old and new, at least for now.
*/
}
if (!strcmp(arg, "--allow-binary-replacement") ||
!strcmp(arg, "--binary")) {
- allow_binary_replacement = 1;
- continue;
+ continue; /* now no-op */
}
if (!strcmp(arg, "--numstat")) {
apply = 0;
index ff052699a28d2d96de4bdaa4702f175527f28536..e2b1124c78540ed9613877d10eed3641268c2c8f 100755 (executable)
--- a/t/t4103-apply-binary.sh
+++ b/t/t4103-apply-binary.sh
'do_reset
git-apply --index C.diff'
-test_expect_failure 'apply binary diff without replacement -- should fail.' \
+test_expect_success 'apply binary diff without replacement.' \
'do_reset
git-apply BF.diff'
-test_expect_failure 'apply binary diff without replacement (copy) -- should fail.' \
+test_expect_success 'apply binary diff without replacement (copy).' \
'do_reset
git-apply CF.diff'