In article <32541b131002031048i26d166d9w3567a60515235c34@xxxxxxxxxxxxxx>, Avery Pennarun <apenwarr@xxxxxxxxx> wrote: > On Wed, Feb 3, 2010 at 1:25 PM, Ron Garret <ron1@xxxxxxxxxxx> wrote: > > So something in my understanding of how git works must be wrong. Git > > must be keeping a separate record of file renames somewhere. But where? > > It doesn't. Your experiment is wrong. > > > [ron@mickey:~/devel/gittest]$ cat>file2 > > 6 > > 7 > > 8 > > 9 > > 10 > > [ron@mickey:~/devel/gittest]$ git mv file2 file3 > > [ron@mickey:~/devel/gittest]$ git commit -m 'letters->numbers' > > [master ae3f6d4] letters->numbers > > 1 files changed, 0 insertions(+), 0 deletions(-) > > rename file2 => file3 (100%) > > Whoops. You didn't 'git add file2' (before the mv) or 'git add file3' > (after the mv), or use commit -a, so what you've committed is the > *old* content of file2 under the name file3. The *new* content of > file2 is still uncommitted in your work tree under the name file3. > This is why git can detect the move. (The 100% is a good clue: it > means the old and new files are 100% identical.) Ah. That explains everything. Thanks. (I thought git mv was equivalent to git rm followed by git add. But it's not.) > Artificial tests like this are useless anyway. Yes, I know. This was not intended to be a real-world example. I was just trying to understand the heuristics that git uses to track filename changes, and in particular, how much a file could change before git decided it was a different file. When I got to zero shared lines between old and new it was clear that I was missing something fundamental :-) So... how *does* git decide when two blobs are different blobs and when they are the same blob with mods? I asked this question before and was pointed to the diffcore docs, but that didn't really clear things up. That just describes all the different ways git can do diffs, not the actual heuristics that git uses to track content. rg -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html