[HYPOTHETICAL PATCH 1/2] apply: reject modification diffs to i-t-a entries

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

 



Because the correct diff between an i-t-a entry and a new file is now a
creation diff, reject diffs from the empty blob as not applying to the
preimage.

Signed-off-by: Raymond E. Pasco <ray@xxxxxxxxxxxx>
---
 apply.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/apply.c b/apply.c
index c5ecb64102..656f00c113 100644
--- a/apply.c
+++ b/apply.c
@@ -3637,6 +3637,9 @@ static int apply_data(struct apply_state *state, struct patch *patch,
 	if (load_preimage(state, &image, patch, st, ce) < 0)
 		return -1;
 
+	if (!(patch->is_new || patch->is_delete) && ce->ce_flags & CE_INTENT_TO_ADD)
+		return -1;
+
 	if (patch->direct_to_threeway ||
 	    apply_fragments(state, &image, patch) < 0) {
 		/* Note: with --reject, apply_fragments() returns 0 */
-- 
2.28.0.5.gfc8e108108




[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]

  Powered by Linux