public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: git@vger•kernel.org
Subject: [PATCH] apply: do not allow reversing a 'copy' patch
Date: Fri, 06 Feb 2015 15:06:01 -0800	[thread overview]
Message-ID: <xmqqa90qd4iu.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <xmqqvbjed76s.fsf@gitster.dls.corp.google.com> (Junio C. Hamano's message of "Fri, 06 Feb 2015 14:08:27 -0800")

Junio C Hamano <gitster@pobox•com> writes:

>         Action item: warn users against using "apply -R" on a
>         patchset with such a patch while this is fixed.

This needs to be replaced with the logic to properly reverse a patch
that creates a new file by copying from somewhere else, but for now,
this would be a good idea to prevent lossages from happening.

 builtin/apply.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/builtin/apply.c b/builtin/apply.c
index 0aad912..b33b403 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -2069,6 +2069,9 @@ static void reverse_patches(struct patch *p)
 	for (; p; p = p->next) {
 		struct fragment *frag = p->fragments;
 
+		if (p->is_copy)
+			die(_("sorry, cannot apply a 'copying' patch in reverse (yet)"));
+
 		swap(p->new_name, p->old_name);
 		swap(p->new_mode, p->old_mode);
 		swap(p->is_new, p->is_delete);

  parent reply	other threads:[~2015-02-06 23:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-06 22:08 [RFH] "diff -B -M" Junio C Hamano
2015-02-06 22:47 ` Junio C Hamano
2015-02-06 23:06 ` Junio C Hamano [this message]
2015-02-06 23:39   ` [PATCH] apply: do not allow reversing a 'copy' patch Stefan Beller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqa90qd4iu.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox