From: Steven Grimm Date: Mon, 05 May 2008 23:07:57 GMT Subject: Re: merge renamed files/directories? Message-ID: In-Reply-To: On May 5, 2008, at 3:20 PM, Linus Torvalds wrote: > I really don't understand why people expect a directory rename to be > handled automatically, when it is (a) not that common and (b) not > obvious > what the solution is, but MOST OF ALL (c) so damn _easy_ to handle it > manually after-the-fact when you notice that something doesn't > compile! Assuming all you track with git is source code that has dependencies such that a compile command fails cleanly when things end up in the wrong directory, sure. If you're using git to, say, track a tree of documentation files or images that are referred to using relative URLs in HTML pages, detecting the breakage is less trivial unless you have a really solid automated QA process that can check for dangling references. Are directory renames as common as file renames? Certainly not. But they happen often enough that it's annoying to have to manually clean up after them. Note that I did not say it is difficult or impossible to manually clean up after them. I think the number of people who've mentioned this on the list should stand as some kind of refutation of the idea that directory renames are so vanishingly rare as to not be worth mentioning. I've run into the problem a few times myself. > and "Tadaa! All done". Your merge that was *fundamentally > impossible* to > do automatically, was trivially done manually, with no actual big > head-scratiching involved. $ mkdir parent $ cd parent $ hg init $ mkdir subdir1 $ echo "I am the walrus" > subdir1/file1 $ hg add subdir1/file1 $ hg commit -m 'initial commit' $ cd .. $ hg clone parent child $ cd child $ hg mv subdir1 subdir2 $ hg commit -m 'rename subdir1 to subdir2' $ cd ../parent $ echo 'I love prunes' > subdir1/file2 $ hg add subdir1/file2 $ hg commit -m 'new file in subdir' $ cd ../child $ hg pull $ hg merge $ ls subdir2 file1 file2 Doesn't seem *fundamentally* impossible to produce the results that are most likely to be what people want. (Which doesn't equal "guaranteed to be 100% correct 100% of the time or your money back" -- as you say, merging is an inexact science.) -Steve