Re: Rename handling
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Mar 21, 2007, 00:25 UTC
- Message-ID
- <Pine.LNX.4.63.0703210120230.22628@wbgn013.biozentrum.uni-wuerzburg.de>
- In-Reply-To
- <etpson$qih$1@sea.gmane.org>
Hi,
On Wed, 21 Mar 2007, Jakub Narebski wrote:
Show 40 quoted lines
> Steven Grimm wrote: > > > The following is actually my biggest beef with git's rename tracking, > > and it has nothing whatsoever to do with git-log (though I agree git-log > > needs to track renames too): > > > > $ ls > > dir1 > > $ ls dir1 > > file1 file2 file3 > > $ echo "#include file1" > dir1/file4 > > $ git add dir1/file4 > > $ git commit > > $ git pull > > $ ls > > dir1 dir2 > > $ ls dir1 > > file4 > > $ ls dir2 > > file1 file2 file3 > > > > That's just plain broken in my opinion. One can perhaps contrive a test > > case or two where that's the desired behavior, but in the real world it > > is almost never what you actually want. > > > > By the way, I don't think fixing that is necessarily related to how > > renames get detected, so in some sense it's a different bug report / > > feature request than the rename hints one. It would be possible to > > figure out the directory had been renamed based purely on content > > analysis; a bunch of files all individually renamed to the same places > > under a new directory, and a lack of any files at all left in the old > > one, probably means the directory got renamed. The content-based rename > > detector could handle this case. > > Actually this came out in some earlier talk about recording renames > and renames detection (IIRC in the big thread about VCS comparison which > used to be on Bazaar-NG wiki). And one of the arguments about why directory > rename doesn't work as _you_ expected is (beside that it is not that > easy to code) the fact that the alternate solution (new files going > to old subdir) can be correct and expected by _others_.
By now, there have been enough arguments _for_ automatic rename detection, but I'll add another one.
A colleague of mine worked on a certain file in a branch, where he copied the file to another location, and heavily modified it. He did that in a branch, and when he was satisfied with the result, he deleted the old file, since he liked the new location better.
Now, when I pulled, imagine my surprise (knowing the history of the file), when the pull reported a rename with a substantial similarity!
So, the automatic renamer did an awesome job.
Ciao, Dscho
P.S.: It would be so nice if somebody (preferably someone who previously thought manual renames were a pretty clever thing) to write up the arguments, and add that to the "why automatic renaming?" section of the FAQ...