From: "Shawn O. Pearce" <spearce@spearce.org>
To: Liraz Siri <liraz.siri@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: git merge bug: creating new files in one branch in a directory that is renamed in another
Date: Sun, 21 Jan 2007 03:44:06 -0500 [thread overview]
Message-ID: <20070121084405.GB10632@spearce.org> (raw)
In-Reply-To: <45B3224B.3020800@gmail.com>
Liraz Siri <liraz.siri@gmail.com> wrote:
> I'm running a few tests to figure out when git does the right thing on
> merges, and I've discovered that git does not do the right thing if you
> are creating new files in one branch in a directory that is renamed in
> another.
Well, it depends on your definition of "the right thing" as to
whether or not Git does it. :-)
> Merging edits of files in dir/ in one branch and renaming dir/ to
> newdir/ in another branch works, but if you create files in the renamed
> dir/ then after the merge they will still remain in dir/, rather than
> newdir/.
Yes. We don't actually track directories, we track contents of
files. Renaming a directory in one branch and adding a file to that
directory in the other branch does not imply that after the merge
the new file belongs in the renamed location. Nor does it imply it
should be in the old location, but that is where we currently put it.
We probably could modify merge-recursive to rename new files added
by the second branch if:
- the file from the second branch does not exist in the merge base
(hence it was added by the second branch);
- the file from the second branch is located under a path where
a prefix of directories exists within the merge base;
- all files in the merge base under that path prefix were either
deleted or renamed to the another path prefix by the first branch.
but I'm not sure how often that occurs in practice that its
worth implmenting, as the implementation is slightly non-trivial.
Especially since it needs to be done for both sides.
--
Shawn.
next prev parent reply other threads:[~2007-01-21 8:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-21 8:20 git merge bug: creating new files in one branch in a directory that is renamed in another Liraz Siri
2007-01-21 8:44 ` Shawn O. Pearce [this message]
2007-01-21 22:05 ` Johannes Schindelin
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=20070121084405.GB10632@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=liraz.siri@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.
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).