From: Junio C Hamano <junkio@cox.net>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Barkalow <barkalow@iabervon.org>,
Linus Torvalds <torvalds@osdl.org>,
Fredrik Kuivinen <freku045@student.liu.se>,
"H. Peter Anvin" <hpa@zytor.com>,
git@vger.kernel.org
Subject: Re: Moved files and merges
Date: Sun, 04 Sep 2005 01:27:08 -0700 [thread overview]
Message-ID: <7vfysli6g3.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: Junio C. Hamano's message of "(unknown date)"
Junio C Hamano <junkio@cox.net> writes:
> All true. Let's redraw that simplified scenario, and see if
> what I said still holds. It may be interesting to store my
> previous message and this one in a file and run diff between
> them.
There are a couple of things worth mentioning about the two
examples (one that I resolved favoring non-rename and
non-addition, and the other I resolved favoring rename and
addition) I gave tonight.
1. When I said "the principles are the same", I was primarily
referring to the part that detects the 'previous' merge,
which of its parents is 'ours' and which is 'theirs'.
Although I handwaved that part in both examples, my gut
feeling is that this part is probably harder than the part
that adjusts trees before merging. klibc vs klibc-kbuild
case had a clear distinction between which commit is ours and
which is theirs, but I am not sure if things are that black
and white in real projects when a lot of criss-crossing
merges are involved.
2. When adjusting trees, I treated removals and additions a bit
differently, but there is no fundamental reason to do so.
In the first example which had a removal, I adjusted the tree
#2 and #6 by removing the path involved. In the second
example which had an addition, I did not adjust the tree #2
and #6 to add that path. But you _could_ do nothing to
adjust for removal; i.e. leaving K in tree #2-adjusted and
#6-adjusted in the first example. Also you _could_ adjust for
the addition by copying K from #3 into #2-adjusted and
copying K from #5 into #6-adjusted in the second example.
If you did the former, merging the resulting #6-adjusted into
#5 pivoting at #2-adjusted would leave a non-trivial conflict
for you to resolve by hand. #6-adjusted changes K from
#2-adjusted while #5 would remove it from #2-adjusted. This
would be a remove-modify conflict (case 7 in the 3-way merge
case table in t/t1000-read-tree-m-3way.sh). But this is only
non-trivial to git and what you want is obvious to you as the
maintainer of the line of development that removed the file
at #3. You removed it the last time, and you remove it this
time again. I adjusted #2 and #6 to remove the path only to
save you from this tedium upfront before the read-tree phase.
Similarly, in the second example, if #2 and #6 are adjusted
for the addition of K by copying K from #3 and #5 into them,
the resulting merge would see that one line #2-adjusted to
#6-adjusted changes K (whose contents is that of
#3) to that of #5, while the other line #2-adjusted to #5
changes K (whose contents is again that of #3) to that of
#5. Since this is both-change-identically (case 12 in the
3-way merge table), it trivially resolves to keep K from #5,
and the result is the same as what you would get from my
second example which did nothing about additions.
next prev parent reply other threads:[~2005-09-04 8:27 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-02 23:59 Moved files and merges H. Peter Anvin
2005-09-03 0:20 ` Martin Langhoff
2005-09-04 4:14 ` H. Peter Anvin
2005-09-03 1:36 ` Junio C Hamano
2005-09-03 8:25 ` Junio C Hamano
2005-09-03 18:06 ` Fredrik Kuivinen
2005-09-03 18:53 ` Junio C Hamano
2005-09-03 18:46 ` Junio C Hamano
2005-09-03 19:05 ` Sam Ravnborg
2005-09-03 19:32 ` Junio C Hamano
2005-09-03 22:03 ` Sam Ravnborg
2005-09-04 7:32 ` Junio C Hamano
2005-09-04 18:28 ` Daniel Barkalow
2005-09-04 19:10 ` Junio C Hamano
2005-09-05 15:16 ` H. Peter Anvin
2005-09-05 15:47 ` Linus Torvalds
2005-09-05 16:37 ` H. Peter Anvin
2005-09-05 18:08 ` Junio C Hamano
2005-09-05 18:33 ` Junio C Hamano
2005-09-05 18:43 ` H. Peter Anvin
2005-09-04 8:27 ` Junio C Hamano [this message]
2005-09-03 19:21 ` Fredrik Kuivinen
2005-09-03 18:59 ` Sam Ravnborg
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=7vfysli6g3.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=barkalow@iabervon.org \
--cc=freku045@student.liu.se \
--cc=git@vger.kernel.org \
--cc=hpa@zytor.com \
--cc=sam@ravnborg.org \
--cc=torvalds@osdl.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).