git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Baudis <pasky@suse.cz>
To: Junio C Hamano <junkio@cox.net>
Cc: Jon Loeliger <jdl@freescale.com>, git@vger.kernel.org
Subject: Re: merge-one-file: use common as base, instead of emptiness.
Date: Thu, 10 Nov 2005 20:43:17 +0100	[thread overview]
Message-ID: <20051110194317.GV30496@pasky.or.cz> (raw)
In-Reply-To: <7v64r16ro9.fsf_-_@assigned-by-dhcp.cox.net>

Dear diary, on Thu, Nov 10, 2005 at 05:41:10AM CET, I got a letter
where Junio C Hamano <junkio@cox.net> said that...
> Petr Baudis <pasky@suse.cz> writes:
> 
> > I think having
> >
> > 	<<<<<
> > 	file1
> > 	=====
> > 	file2
> > 	>>>>>
> >
> > is an awful PITA to resolve, especially when the files actually are
> > similar. Running some vimdiff (or just diff and possibly applying either
> > way) on two separate files is much more convenient.
> 
> You are right.
> 
> How about something like this?  This adds a specialized hackery
> flag, --no-add, to git-apply, and uses it to compute common base
> to be used for 2-file merge, instead of using /dev/null.

Wow, astonishingly simple.

>  -- >8 -- cut here -- >8 --
> Unlike the previous round that merged the path added differently
> in each branches using emptiness as the base, compute a common
> version and use it as input to 'merge' program.
> 
> This would show the resulting (still conflicting) file left in
> the working tree as:
> 
> 	common file contents...
> 	<<<<<< FILENAME
> 	version from our branch...
> 	======
> 	version from their branch...
> 	>>>>>> .merge_file_XXXXXX
> 	more common file contents...
> 
> when both sides added similar contents.

But obviously now the trouble is opposite, when the files are completely
unrelated, since now you likely get large conflicting areas interleaved
with some scarce common lines... And this might get to be a big PITA to
resolve as well.

That said, I still really like --no-add and it would be heart-wrenching
to just coldly dismiss it. It is a great tool, but I would let the user
to use it manually. Possibly something like

	git-twofile-merge foo~1 foo~2

(the name is stupid, obviously) or a button in some GUI tool.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
VI has two modes: the one in which it beeps and the one in which
it doesn't.

  reply	other threads:[~2005-11-10 19:43 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-08  3:43 Expected Behavior? Jon Loeliger
2005-11-08  6:00 ` Junio C Hamano
2005-11-08  9:56   ` Petr Baudis
2005-11-10  4:41     ` merge-one-file: use common as base, instead of emptiness Junio C Hamano
2005-11-10 19:43       ` Petr Baudis [this message]
2005-11-10 20:30         ` Junio C Hamano
2005-11-10 20:35           ` Petr Baudis
2005-11-08 21:03   ` Expected Behavior? Fredrik Kuivinen
2005-11-08 21:41     ` Junio C Hamano
2005-11-08 22:53       ` Fredrik Kuivinen
2005-11-09  5:50         ` Junio C Hamano
2005-11-09  8:19           ` Fredrik Kuivinen
2005-11-09 10:42             ` [PATCH] merge-recursive: Fix support for branch names containing slashes Fredrik Kuivinen
2005-11-10 20:34             ` Expected Behavior? Petr Baudis
2005-11-10 22:52               ` Junio C Hamano
2005-11-10 23:22                 ` Petr Baudis
2005-11-09 11:24     ` Petr Baudis
2005-11-09 23:04       ` Martin Langhoff
2005-11-09 23:12         ` Petr Baudis
2005-11-09 23:43           ` Martin Langhoff
2005-11-09 23:49             ` Petr Baudis
2005-11-10  2:47               ` Martin Langhoff
2005-11-10 19:34                 ` Petr Baudis
2005-11-10 19:54                   ` Martin Langhoff
2005-11-10 20:10                     ` Petr Baudis
2005-11-09 23:36         ` Junio C Hamano
2005-11-09 23:42           ` Petr Baudis
2005-11-10  0:03             ` 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051110194317.GV30496@pasky.or.cz \
    --to=pasky@suse.cz \
    --cc=git@vger.kernel.org \
    --cc=jdl@freescale.com \
    --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).