Junio C Hamano <gits...@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.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to