[PATCH] apply: do not allow reversing a 'copy' patch
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 6, 2015, 23:06 UTC
- Message-ID
- <xmqqa90qd4iu.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <xmqqvbjed76s.fsf@gitster.dls.corp.google.com>
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);