git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Junio C Hamano <junkio@cox.net>
Cc: Catalin Marinas <catalin.marinas@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] Add a test-case for git-apply trying to add an ending line
Date: Wed, 24 May 2006 07:49:46 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0605240745590.5623@g5.osdl.org> (raw)
In-Reply-To: <7v8xosqaqm.fsf@assigned-by-dhcp.cox.net>



On Tue, 23 May 2006, Junio C Hamano wrote:

> Linus Torvalds <torvalds@osdl.org> writes:
> 
> > On Tue, 23 May 2006, Junio C Hamano wrote:
> >
> >> 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.
> >
> > We can. Something like this should do it.
> >
> > (The same thing could be done for "match_beginning", perhaps).
> 
> But this is exactly what I said I had trouble with in the above.

Well, not quite. You said "not the same number of lines", and I say "no 
ending context". Very different.

My patch actually is totally self-consistent: not having any context at 
the end of a unified diff really means that it is the end of the file (ie, 
the "end of file" there _is_ the context). And if you want to apply files 
without context, you should use "-Cx", and my patch does that too - if you 
asked for "relaxed context checking", it will re-try without the "only at 
end" check thanks to the

	if (match_end) {
		match_end = 0;
		continue;
	}

so it all should work.

Not that I _tested_ it, of course ;)

		Linus

      parent reply	other threads:[~2006-05-24 14:50 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
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 [this message]

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=Pine.LNX.4.64.0605240745590.5623@g5.osdl.org \
    --to=torvalds@osdl.org \
    --cc=catalin.marinas@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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).