From: Junio C Hamano <junkio@cox.net>
To: Git Mailing List <git@vger.kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>, Alex Riesen <raa.lkml@gmail.com>
Subject: Re: git rebase chokes on directory -> symlink -> directory
Date: Sun, 13 May 2007 21:37:44 -0700 [thread overview]
Message-ID: <7v1whkow9z.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <7vps569904.fsf@assigned-by-dhcp.cox.net> (Junio C. Hamano's message of "Fri, 11 May 2007 17:32:43 -0700")
Junio C Hamano <junkio@cox.net> writes:
> However.
>
> I usually have "[apply] whitespace = strip" in my ~/.gitconfig,
> but during this verification run, I disabled it to keep rebase
> from falling back to 3-way merge using merge-recursive. If I
> turn it on, rebase still fails and I strongly suspect "rebase
> -m" would fail the same way, although I haven't tried it (it
> takes too much time).
>
> I'll be somewhat busy this weekend, so I would welcome anybody
> else beating me to fixing the problem in merge-recursive.
Yuck. merge-recursive does seem to have problem with D/F
conflict in general; I suspect this is not limited to cases that
involve symbolic links.
First, the setup.
$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux-2.6-newsetup.git/
$ cd linux-2.6-newsetup.git
$ git fetch git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git/
$ git branch other b2ad90f4969226fe8cf3edc5330711ed5fc20105
$ git branch ancestor other^1
$ git reset --hard ancestor
$ echo >>Makefile ; git add Makefile ; git commit -m 'change one'
$ git branch try
To see that the underlying read-tree is working as expected (and
do not have to be debugged), we can first try the usual three-way
read tree:
$ git read-tree -m -u ancestor HEAD other
$ git ls-files -u --abbrev arch/x86-64
This would show...
120000 ad3f146 3 arch/x86_64/boot
100644 495f20c 1 arch/x86_64/boot/.gitignore
100644 495f20c 2 arch/x86_64/boot/.gitignore
100644 ee6f650 1 arch/x86_64/boot/Makefile
100644 ee6f650 2 arch/x86_64/boot/Makefile
...
The current HEAD (the one that we tagged as 'try') has the
directory arch/x86_64/boot/, but all of its files are unchanged
from the "common ancestor", so they all have identical stages 1
and 2, with stage 3 missing. The other tree has boot/ as a
symlink. These "One-side removes other side does not touch" and
"one-side adds" cases are left unmerged by "read-tree -m -u", as
that is how merge-recursive can find renames to begin with.
Now we've seen what the read-tree (which is the same machinery
used as git_merge_trees() in mege-recursive) does with these
three trees, let's see how merge-recursive finishes this off:
$ git reset --hard try
$ git merge-recursive ancestor -- HEAD other
CONFLICT (directory/file): There is a directory with name arch/x86_64/boot in HEAD. Added arch/x86_64/boot as arch/x86_64/boot~other
Removed arch/x86_64/boot/.gitignore
Removed arch/x86_64/boot/Makefile
Removed arch/x86_64/boot/bootsect.S
Removed arch/x86_64/boot/compressed/Makefile
Removed arch/x86_64/boot/compressed/head.S
Removed arch/x86_64/boot/compressed/misc.c
Removed arch/x86_64/boot/compressed/vmlinux.lds
Removed arch/x86_64/boot/compressed/vmlinux.scr
Removed arch/x86_64/boot/install.sh
Removed arch/x86_64/boot/mtools.conf.in
Removed arch/x86_64/boot/setup.S
Removed arch/x86_64/boot/tools/.gitignore
Removed arch/x86_64/boot/tools/build.c
There is no rename, so rename detection does not interfere, but
the D/F conflict detection code in merge-recursive thinks that
arch/x86_64/boot is a directory in one tree (yes, it is true in
the original tree, but it goes away as all files under it), and
a non-directory in another. And instead of replacing the boot/
directory that becomes empty with a new symlink boot/, it
creates the boot~funny-name symlink and fails the operation.
When it actually is checking out arch/x86_64/boot out of the
resolved index, it should notice that (1) arch/x86_64/boot
directory is unnecessary to house anything in the resulting
index anymore, and that (2) there is no locally created
untracked file that is 'precious' [*1*]. Then it can rmdir()
and create the boot/ symlink in its place. To fix this, it may
be necessary to update its checkout code to perform the "remove
first then create" two-pass process git-apply does.
It is unfortunate that for merge-recursive it is probably too
cumbersome to always do the right thing, but I think it should
at least notice that arch/x86_64/boot whose files all disappear
does not conflict with creation of the new symlink.
prev parent reply other threads:[~2007-05-14 4:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-08 1:08 git rebase chokes on directory -> symlink -> directory H. Peter Anvin
2007-05-08 21:50 ` Alex Riesen
2007-05-09 2:43 ` H. Peter Anvin
2007-05-09 7:50 ` Alex Riesen
2007-05-09 16:58 ` H. Peter Anvin
2007-05-09 21:39 ` Alex Riesen
2007-05-09 22:44 ` H. Peter Anvin
2007-05-10 6:44 ` Junio C Hamano
2007-05-10 7:55 ` Johannes Sixt
2007-05-10 22:04 ` Shawn O. Pearce
2007-05-11 6:04 ` Junio C Hamano
2007-05-11 15:56 ` Linus Torvalds
2007-05-11 17:28 ` Junio C Hamano
2007-05-11 4:36 ` [PATCH] apply: do not get confused by symlinks in the middle Junio C Hamano
2007-05-12 0:32 ` git rebase chokes on directory -> symlink -> directory Junio C Hamano
2007-05-12 0:35 ` H. Peter Anvin
2007-05-14 4:37 ` Junio C Hamano [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
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=7v1whkow9z.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
--cc=hpa@zytor.com \
--cc=raa.lkml@gmail.com \
/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).