git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Junio C Hamano <junkio@cox.net>, git@vger.kernel.org
Subject: Re: [PATCH] Fall back to three-way merge when applying a patch.
Date: Wed, 5 Oct 2005 19:18:41 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0510051909390.31407@g5.osdl.org> (raw)
In-Reply-To: <m1mzln9zi1.fsf@ebiederm.dsl.xmission.com>



On Wed, 5 Oct 2005, Eric W. Biederman wrote:
>
> There is another workable strategy.  Modify git-diff-xxx to report
> the sha1 of the tree, or the sha1's of the files the patch applies to.

Not workable.

It fundamentally only works for the first patch in a series. After that, 
the rest will be based off a version that the recipient simply doesn't 
have (well, if it's the _tree_ SHA1, and the recipient has no other 
patches, then they'll match, but that case is uninteresting, since it's 
the trivial case that you always get right by just applying the things in 
the first place).

So you'd have to make it the base for the patch _series_, at a minimum.

And even that likely doesn't work very often. Any time you have a private 
merge or some other patch in your tree, the recipient wouldn't be able to 
parse it.

In practice, I've found that most often it's very trivially obvious _why_ 
a patch doesn't apply (I remember the "other patch" that happened to the 
same file, or I just do a "git-whatchanged -p filename"), and it can be 
useful to allow the person applying the patch to say "ok, try to apply it 
against version xyz, and do a three-way merge".

But it really tends to be fairly rare.

Now obviously, some of that may be kernel-specific - a large part of the 
lack of patch conflicts is that we over the years have actively tried to 
set up the kernel sources so that people seldom step on each other (one 
example is how we have all modules contain their own "init_module()" thing 
and sortign it out in the linker - because the old init/main.c approach 
was _very_ painful since everybody wanted to add lines to the same file).

So it may turn out that other projects might have different wishes for how 
something like this would work. But I doubt it works very well to rely on 
commit-level SHA1's - it's more likely to work if you try the "last few 
tagged releases etc", since patches that don't apply are often against the 
previous release (and if they don't apply there either, then it's probably 
not worth fighting over anyway).

		Linus

  reply	other threads:[~2005-10-06  2:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-05  0:46 [PATCH] Fall back to three-way merge when applying a patch Junio C Hamano
2005-10-05  4:56 ` Linus Torvalds
2005-10-05  6:58   ` Junio C Hamano
2005-10-05 14:30     ` Linus Torvalds
2005-10-06  0:03       ` Junio C Hamano
2005-10-06  1:59         ` Eric W. Biederman
2005-10-06  2:18           ` Linus Torvalds [this message]
2005-10-06  4:17             ` Junio C Hamano
2005-10-06  5:25             ` Eric W. Biederman
2005-10-06 14:35               ` Linus Torvalds
2005-10-06 14:52                 ` Eric W. Biederman
2005-10-06 14:59                   ` Linus Torvalds
2005-10-06 17:07                     ` Eric W. Biederman
2005-10-07  2:33                     ` [PATCH] Show original and resulting blob object info in diff output Junio C Hamano
2005-10-07  4:47                       ` Linus Torvalds
2005-10-07  5:16                         ` Junio C Hamano
2005-10-06  7:33             ` [PATCH] Fall back to three-way merge when applying a patch Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

* 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.0510051909390.31407@g5.osdl.org \
    --to=torvalds@osdl.org \
    --cc=ebiederm@xmission.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).