All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: Re: [RFH] "diff -B -M"
Date: Fri, 06 Feb 2015 14:47:24 -0800	[thread overview]
Message-ID: <xmqqegq2d5dv.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:

> 5. Third twist: rewriting by copying
> ...
> One possible way to fix this is to include another patch in the same
> patchset that shows the deletion of major-11.txt.  The rule 2. would
> be further revised to something like:
>
>  rule 2. a patch renaming file A to file B requires that file A
>          exists and file B does not exist in the target tree, unless
>          another patch in the patchset renames file B to some other
>          file (possibly but not necessarily file A) or removed file

Typofix: s/removed/removes/

>          B, in which case file B must appear in the target tree.
>
> Such a patchset would look like this:
>
>     diff --git a/major-08.txt b/major-11.txt
>     similarity index 97%
>     rename from major-08.txt
>     rename to major-11.txt
> ...
>     diff --git a/major-11.txt b/major-11.txt
>     deleted file mode 100644
> ...
>
> And these patches, under the re-revised rule 2. and rule 4., would
> apply cleanly to the old tree.
>
> What about the reverse application?  It would be a patchset that
> creates major-11.txt from nothingness, and creates major-08.txt by
> renaming major-11.txt and editing.  Is the rule 2. re-revised above
> sufficient?
>
>     renaming major-11.txt to major-08.txt requires that major-08.txt
>     does not exist in the target tree, unless...
>
> and the new tree (which is the target of the reverse application)
> only has major-11.txt and not major-08.txt, so this rename should go
> through.  The reverse of the deletion of major-11.txt is a creation
> of it with the contents fully given as the pre-image of the
> (original) patch before reversing it, so that should also be OK with
> rule 3.

... But rule 3. needs tweaking.  The second patch would be creating
major-11.txt which requires major-11.txt to be missing in the target
tree.  But obviously, the new tree the patch we are applying in
reverse was taken from has major-11.txt.  So we would need a
revision to it as well.

 rule 3. a patch that creates file A requires that file A does not exist
         in the target tree, unless another patch in the same patchset
         renames file A away or removes it.

> So tentatively, I would say...
>
> 	Action item: do not filter delete-half of the broken pair
> 	out, even when the other create-half of the pair no longer
> 	is in the output.
>
> 	Action item: update "git apply" to honor the rule 2.
> 	re-revised above.

The latter should read:

	update "git apply" to honor the revised rule 2. and 3.

  reply	other threads:[~2015-02-06 22:47 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 [this message]
2015-02-06 23:06 ` [PATCH] apply: do not allow reversing a 'copy' patch Junio C Hamano
2015-02-06 23:39   ` 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=xmqqegq2d5dv.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.