{"thread":{"id":"15371","subject":"Failed expectations or bug?","startedAt":"2008-09-04T09:49:57Z","lastAt":"2008-09-04T10:18:28Z","messageCount":2,"participants":["Pedro Melo","Matthias Kestenholz"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"89749","messageId":"EA0C3F3E-0DA8-49A7-8151-5A2EC6C7BEEA@simplicidade.org","threadId":"15371","inReplyTo":null,"subject":"Failed expectations or bug?","fromName":"Pedro Melo","fromEmail":"melo@simplicidade.org","sentAt":"2008-09-04T09:49:57Z","receivedAt":"2008-09-04T09:49:57Z","isPatch":false,"sender":{"key":"melo@simplicidade.org","avatar":"https://gravatar.com/avatar/13ddbb01e300285a93aa1e3739653a81f9b1d3438bd03a4ac36b88e4ffeeafc3?d=mp&s=160"},"body":"Hi,\n\nI was learning about git rename detection and came across a unexpected  \nresult. See the following sequence:\n\n$ mkdir /tmp/test-git\n$ cd /tmp/test-git/\n$ git init\nInitialized empty Git repository in /private/tmp/test-git/.git/\n$ git config diff.renames copies\n$ echo a >> a\n$ echo b >> a\n$ echo c >> a\n$ echo d >> a\n$ git add a ; git commit -m 'added a'\nCreated initial commit a90001f: added a\n  1 files changed, 4 insertions(+), 0 deletions(-)\n  create mode 100644 a\n$ git checkout -b t\nSwitched to a new branch \"t\"\n$ git mv a b\n$ git commit -m 'moved a to b'\nCreated commit 5f11e2f: moved a to b\n  1 files changed, 0 insertions(+), 0 deletions(-)\n  rename a => b (100%)\n$ cp b c\n$ git add c\n$ git commit -m 'added c'\nCreated commit 8bf67c0: added c\n  1 files changed, 4 insertions(+), 0 deletions(-)\n  create mode 100644 c\n$ git checkout master\nSwitched to branch \"master\"\n$ perl -pi -e 's/d/D/' a\n$ git add a\n$ git commit -m 'd is now D'\nCreated commit c082684: d is now D\n  1 files changed, 1 insertions(+), 1 deletions(-)\n$ git merge t\nMerge made by recursive.\n  a => b\u001b|    2 +-\n  a => c\u001b|    0\n  2 files changed, 1 insertions(+), 1 deletions(-)\u001b[m\n  copy a => b (75%)\n  rename a => c (100%)\n$ ls\nb\tc\n$ cat b\na\nb\nc\nd\n$ cat c\na\nb\nc\nD\n\n\nMaybe I have the wrong expectations, but after the merge I was  \nexpecting either:\n\n  * b and c have the same content, with the modified D;\n  * b has the modifications made in master, and c has the original  \ncontent.\n\nI did not expect the patch to 'a' in master to propagate across the  \ncopy to c.\n\nWhat am I doing wrong here?\n\nThanks,\n-- \nPedro Melo\nBlog: http://www.simplicidade.org/notes/\nXMPP ID: melo@simplicidade.org\nUse XMPP!\n"},{"id":"89751","messageId":"1f6632e50809040318n2974cdf2t3664c759978dc8d3@mail.gmail.com","threadId":"15371","inReplyTo":"EA0C3F3E-0DA8-49A7-8151-5A2EC6C7BEEA@simplicidade.org","subject":"Re: Failed expectations or bug?","fromName":"Matthias Kestenholz","fromEmail":"mk@spinlock.ch","sentAt":"2008-09-04T10:18:28Z","receivedAt":"2008-09-04T10:18:28Z","isPatch":false,"sender":{"key":"matthias@spinlock.ch","avatar":"https://gravatar.com/avatar/bc18f396e70163d09ab458a341b1decb7e8b6ee3aa2c0c954ec20162e67c4d46?d=mp&s=160"},"body":"On Thu, Sep 4, 2008 at 11:49 AM, Pedro Melo <melo@simplicidade.org> wrote:\n> Hi,\n>\n> I was learning about git rename detection and came across a unexpected\n> result. See the following sequence:\n>\n> [...]\n>\n> Maybe I have the wrong expectations, but after the merge I was expecting\n> either:\n>\n>  * b and c have the same content, with the modified D;\n>  * b has the modifications made in master, and c has the original content.\n>\n> I did not expect the patch to 'a' in master to propagate across the copy to\n> c.\n>\n> What am I doing wrong here?\n>\n\nThe rename detection needs more than a single character to work reliably.\n\nIf you do roughly the same test but with bigger files you should get better the\nresults.\n\nMatthias\n"}]}