From: Steven Grimm <koreth@midwinter.com>
To: John Goerzen <jgoerzen@complete.org>
Cc: git@vger.kernel.org
Subject: Re: Rename handling
Date: Mon, 19 Mar 2007 11:14:51 -0700 [thread overview]
Message-ID: <45FED31B.8070307@midwinter.com> (raw)
In-Reply-To: <slrnevtdfh.v0v.jgoerzen@katherina.lan.complete.org>
John Goerzen wrote:
> 2) For me, a rename is a logical change to the source tree that I want
> to be recorded with absolute certainty, not guessed about later.
> Sometimes I may make API changes and it is useful to see how module
> names changed, with complete precision, later. I do not want to be
> victim to an incorrect guess, which could be possible.
>
If you commit your renames separately from your content changes, it'll
be unambiguous and you won't have to worry about it. That's what I
usually do when this is a concern and it has yet to break for me.
On the other hand, I agree with your general point; I really don't like
being uncertain about whether renames are going to come out correctly or
not ("it has always worked before" and "it is by design unable to fail"
are two very different things.) In particular, I strongly disagree with
the "names are just syntactic sugar, it's the content we're tracking"
philosophy. Here's a simple example of why:
#include <xyz.h>
That simple statement is an intermingling of content and namespace. The
presence of something like that actually breaks the "commit the rename
separately" approach -- if you rename xyz.h to something else and commit
just that rename, that revision won't compile, and I *really* don't like
intentionally committing broken revisions.
Okay, so you say, rename xyz.h and update the references to it, but
don't actually modify it. Fine, that works in this case. Now how about
this one:
public abstract class Foo {
private static Logger logger = Logger.getLogger(Foo.class.getName());
}
The references to the name "Foo.java" in that case are within the file
itself (assuming you're using a Java compiler that requires the filename
and class name to match, which the common ones do.) You can't change
just the references without changing the file you're renaming. And,
depending on how many self-references there are in this file, it's
anyone's guess whether the content-based rename detection will consider
the renamed file to be close enough to the old one to be a probable rename.
Combine renames with major code refactoring where the content changes
substantially, and all bets are off.
Now, having said all that, I'll argue in favor of the content-based
rename support for a moment. It is extremely cool that git will actually
detect renames in third-party packages where you've just untarred a new
release into your git repository and committed it, but have given git no
hints at all about the nature of the content changes. I'm not aware of
any other version control system that'll do that, and I've taken
advantage of that feature in the past. So by no stretch am I saying that
content-based rename detection is worthless.
But I would sure rest a lot easier if "git mv" would record a "the user
renamed this file" entry in some log somewhere and the merge code would
see that entry and say, "aha, no need to guess at it, file X got renamed
to Y." Bonus points if that record could apply to directories too, so
you don't have the "I created a new file in a directory you renamed, and
after git-pull my file is still sitting by itself in the old directory"
bug. If no such record exists, then the current rename code should still
be invoked to work its considerable magic.
So to answer your question, in my opinion if 100% guaranteed renames are
high on your priority list, then Mercurial might be the better option
for now. In practice, I've found that git's 99+% rename detection has
yet to fail on me aside from the above directory renaming case, but at
the end of the day it *is* guessing at your renames after the fact.
Okay, git gurus, show me no mercy. :)
-Steve
next prev parent reply other threads:[~2007-03-19 18:17 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-19 16:10 Rename handling John Goerzen
2007-03-19 18:14 ` Steven Grimm [this message]
2007-03-19 18:35 ` Nicolas Pitre
2007-03-19 18:48 ` Linus Torvalds
2007-03-19 19:57 ` Steven Grimm
2007-03-19 20:19 ` Martin Langhoff
2007-03-20 8:33 ` Junio C Hamano
2007-03-19 20:22 ` Linus Torvalds
2007-03-19 20:02 ` Robin Rosenberg
2007-03-19 20:34 ` Linus Torvalds
2007-03-19 19:36 ` Steven Grimm
2007-03-19 19:45 ` Steven Grimm
2007-03-19 20:07 ` Linus Torvalds
2007-03-19 20:17 ` Nicolas Pitre
2007-03-19 20:44 ` Daniel Barkalow
2007-03-19 19:03 ` Andy Parkins
2007-03-19 19:21 ` Steven Grimm
2007-03-21 0:06 ` Jakub Narebski
2007-03-21 0:25 ` Johannes Schindelin
2007-03-21 22:28 ` Steven Grimm
2007-03-21 23:01 ` Johannes Schindelin
2007-03-21 23:10 ` Linus Torvalds
2007-03-22 0:10 ` Martin Langhoff
2007-03-22 2:01 ` Jakub Narebski
2007-03-22 2:39 ` Martin Langhoff
2007-03-22 3:32 ` Jakub Narebski
2007-03-22 3:53 ` Linus Torvalds
2007-03-19 19:15 ` Daniel Barkalow
2007-03-19 19:49 ` John Goerzen
2007-03-19 22:27 ` Junio C Hamano
2007-03-21 0:21 ` Jakub Narebski
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=45FED31B.8070307@midwinter.com \
--to=koreth@midwinter.com \
--cc=git@vger.kernel.org \
--cc=jgoerzen@complete.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).