From: David Woodhouse <dwmw2@infradead.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: git@vger.kernel.org, James Bottomley <James.Bottomley@SteelEye.com>
Subject: Re: Handling renames.
Date: Thu, 14 Apr 2005 20:09:36 +0100 [thread overview]
Message-ID: <1113505776.12012.210.camel@baythorne.infradead.org> (raw)
In-Reply-To: <Pine.LNX.4.58.0504141102430.7211@ppc970.osdl.org>
On Thu, 2005-04-14 at 11:11 -0700, Linus Torvalds wrote:
> So, you really need to think of git as a filesystem. You can then
> implement an SCM _on_top_of_it_, which means that your second suggestion
> is not only acceptable, it really is the _only_ way to handle this in git:
>
> > So a commit involving a rename would look something like this...
> >
> > tree 82ba574c85e9a2e4652419c88244e9dd1bfa8baa
> > parent bb95843a5a0f397270819462812735ee29796fb4
> > rename foo.c bar.c
> > author David Woodhouse <dwmw2@hades.cambridge.redhat.com> 1113499881 +0100
> > committer David Woodhouse <dwmw2@hades.cambridge.redhat.com> 1113499881 +0100
> > Rename foo.c to bar.c and s/foo_/bar_/g
>
> Except I want that empty line in there, and I want it in the "free-form"
> section. The "rename" part really isn't part of the git header. It's not
> what git tracks, it was tracked by an SCM system on top of git.
Note that not only may you have a _set_ of renames, but you'll also have
a _different_ set of renames for each parent. Consider the
representation of a merge where a file was called 'foo' in one parent,
'bar' in the other, and we called it 'foobar' in the resulting tree.
That's the main reason I wanted the renames in with the parent
information -- so it's <parent><rename><rename><...><parent><rename>...
I see your point though and I can't be bothered to argue for the sake of
the slight efficiency benefit we might gain from doing it that way. The
implementation details really aren't that interesting right now.
Let us assume, however, that we have this information somehow stored in
each commit object. It's perfectly sufficient from the POV of the
'git revtool' which I've been poking at; is it good enough for merges?
Consider a simple case: A branch is taken, file foo.c is renamed to
bar.c, and now we're trying to merge that branch back into the head,
which has moved on.
We can't just take 'bar.c' as a new file -- we have to track it all the
way back to its inception, and notice that it actually shares a common
ancestor with 'foo.c' in the other parent of the merge.
How feasible, and how computationally expensive, is that task going to
be? Especially given that there may be _many_ new files that we need to
attempt to tie up with their partners, across many potential renames.
One option for optimising this, if we really need to, might be to track
the file back to its _first_ ancestor and use that as an identification.
The SCM could store that identifier in the blob itself, or we could
consider it an 'inode number' and store it in git's tree objects.
If we can avoid that, however, it would be nice. How feasible is the
merge going to be without it?
--
dwmw2
next prev parent reply other threads:[~2005-04-14 19:06 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-14 17:54 Handling renames David Woodhouse
2005-04-14 18:11 ` Linus Torvalds
2005-04-14 19:09 ` David Woodhouse [this message]
2005-04-14 18:12 ` Ingo Molnar
2005-04-14 18:32 ` Linus Torvalds
2005-04-14 18:58 ` Ingo Molnar
2005-04-14 19:20 ` David Woodhouse
2005-04-14 19:21 ` David Mansfield
2005-04-14 18:21 ` H. Peter Anvin
2005-04-14 18:48 ` Linus Torvalds
2005-04-14 18:49 ` H. Peter Anvin
2005-04-14 19:22 ` Zach Welch
2005-04-14 19:40 ` Andrew Timberlake-Newell
2005-04-14 20:42 ` Naming the SCM (was Re: Handling renames.) Steven Cole
2005-04-14 20:53 ` Petr Baudis
2005-04-14 20:58 ` H. Peter Anvin
2005-04-14 21:01 ` Petr Baudis
2005-04-14 23:17 ` Peter Williams
2005-04-14 22:23 ` Handling renames Daniel Barkalow
2005-04-14 22:46 ` David Woodhouse
-- strict thread matches above, loose matches on Subject: below --
2005-04-15 13:37 linux
2005-04-15 13:53 ` David Woodhouse
2005-10-21 23:40 git-rev-list: add "--dense" flag Linus Torvalds
2005-10-22 0:37 ` Petr Baudis
2005-10-22 0:47 ` Handling renames Petr Baudis
2005-10-22 1:28 ` Linus Torvalds
2005-10-22 1:51 ` Petr Baudis
2005-10-22 2:10 ` Junio C Hamano
2005-10-22 2:49 ` Petr Baudis
2005-10-22 3:23 ` Linus Torvalds
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=1113505776.12012.210.camel@baythorne.infradead.org \
--to=dwmw2@infradead.org \
--cc=James.Bottomley@SteelEye.com \
--cc=git@vger.kernel.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).