git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Add a test-case for git-apply trying to add an ending line
Date: Tue, 23 May 2006 18:09:29 -0700	[thread overview]
Message-ID: <7vpsi4xm7q.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: 7vd5e4z2je.fsf@assigned-by-dhcp.cox.net

Junio C Hamano <junkio@cox.net> writes:

> To git-apply, this patch:
>
>         diff --git a/file b/file
>         --- a/file
>         +++ b/file
>         @@ -1,2 +1,3 @@
>          a
>          b
>         +c
>
> currently means "I want to append a line c immediately after the
> lines that have a and then b".
>...
> I do not think this is necessarily a bug.  You _could_ make the
> EOF a special case (i.e. you _could_ interpret the patch that it
> also says, with "@@ -1,2", that "the result of this patch _must_
> end with this line I just added"), and if you are going to do
> that, you would also need a symmetric special case for the
> beginning of the file, but I do not think it is the right thing
> to do in general.

Come to think of it, the above argument is bogus.  We _would_
want to make EOF just like any other context lines.

The issue is if we can reliably tell if there is such an EOF
context by looking at the diff.  Not having the same number of
lines that starts with ' ' in the hunk is not really a nice way
of doing so (you could make a unified diff that does not have
trailing context at all), and I do not offhand think of a good
way to do so.

  reply	other threads:[~2006-05-24  1:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-23 21:48 [PATCH] Add a test-case for git-apply trying to add an ending line Catalin Marinas
2006-05-24  0:31 ` Junio C Hamano
2006-05-24  1:09   ` Junio C Hamano [this message]
2006-05-24  1:09   ` Junio C Hamano
2006-05-24  2:08     ` Linus Torvalds
2006-05-24  2:17       ` Linus Torvalds
2006-05-24  4:59       ` Junio C Hamano
2006-05-24 13:32         ` Catalin Marinas
2006-05-24 14:49         ` Linus Torvalds

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=7vpsi4xm7q.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=catalin.marinas@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).