Re: [PATCH 7/7] apply --allow-overlap: fix a corner case

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

 



Hi Junio,

On Fri, 6 Dec 2019, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes:
>
> > The beginning is more special than the end because it is associated with
> > the line number 1. The end line number is flexible already.
>
> Yeah, we do not insist "the lineno must be X" at the end like we do
> at the beginning, but we still insist "there cannot be no post
> context if we are adding at the end" just like there cannot be any
> pre context for a patch that adds at the beginning, no?

True.

> > There is another difference: after splitting hunks, the first hunk is
> > applied first, and may render the line numbers of succeeding hunks
> > incorrect. The same is not true for the last hunk: it cannot render the
> > preceding hunks' line numbers incorrect, as it has not been applied yet.
>
> This truly may make quite a difference, especially because the hunks
> are applied in order.

I think you're right, I fooled myself into believing that the line number
1 is special, but the real culprit is that the second hunk is applied
_after_ the first one may have changed the (overlapping) context. The same
is not true for the second-to-last hunk: it will always be applied before
the end of the file can possibly become no longer the end of the file.

I'll try to think up a concise paragraph about this, and stick it into the
commit message.

Ciao,
Dscho




[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