{"thread":{"id":"18251","subject":"BUG: git can't handle certain kinds of renames in merges","startedAt":"2009-03-10T14:45:25Z","lastAt":"2009-03-10T19:51:00Z","messageCount":3,"participants":["Caleb Cushing","Pieter de Bie"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"107581","messageId":"81bfc67a0903100745m3a425337h3f4f7cdbde6b5cfe@mail.gmail.com","threadId":"18251","inReplyTo":null,"subject":"BUG: git can't handle certain kinds of renames in merges","fromName":"Caleb Cushing","fromEmail":"xenoterracide@gmail.com","sentAt":"2009-03-10T14:45:25Z","receivedAt":"2009-03-10T14:45:25Z","isPatch":false,"sender":{"key":"xenoterracide@gmail.com","avatar":"https://gravatar.com/avatar/af3f0745dfa0ea9c4ee551d7d0a3cfe7ba8d229754c11678ab2ed23c3fa57065?d=mp&s=160"},"body":"git actually sucks at some merges 101 :P. I'm going to have to play\nwith my test repository further because eventually I should be able to\nget git-write-tree failures making any kind of 'merge' impossible.\n\ngit://github.com/xenoterracide/git-test-case.git\n\nclone that. checkout branch 1. then git merge master to see my end failure.\n\nsteps to create\n\nadd a file in a branch with a line (or more).\ncreate a new branch based on this branch and check it out.\nin the new branch mv the file into a directory with the same name as\nthe file was. add -u and add the file so git sees the rename.\ncheckout the original branch add some lines. checkout the new branch\nmerge. the merge will go fine.\nremove a line from the new branches file.\ncheckout master. add another line to that file.\ncheckout new branch and attempt to merge.\n\nyou should now see the point that may test case is at.\n-- \nCaleb Cushing\n\nhttp://xenoterracide.blogspot.com\n"},{"id":"107589","messageId":"252A6411-2658-4DC6-A7F4-29CA3981F8FB@frim.nl","threadId":"18251","inReplyTo":"81bfc67a0903100745m3a425337h3f4f7cdbde6b5cfe@mail.gmail.com","subject":"Re: BUG: git can't handle certain kinds of renames in merges","fromName":"Pieter de Bie","fromEmail":"pieter@frim.nl","sentAt":"2009-03-10T16:02:05Z","receivedAt":"2009-03-10T16:02:05Z","isPatch":false,"sender":{"key":"pieter@frim.nl","avatar":null},"body":"\nOn Mar 10, 2009, at 2:45 PM, Caleb Cushing wrote:\n\n> git://github.com/xenoterracide/git-test-case.git\n>\n> clone that. checkout branch 1. then git merge master to see my end  \n> failure.\n>\n> steps to create\n>\n> add a file in a branch with a line (or more).\n> create a new branch based on this branch and check it out.\n> in the new branch mv the file into a directory with the same name as\n> the file was. add -u and add the file so git sees the rename.\n> checkout the original branch add some lines. checkout the new branch\n> merge. the merge will go fine.\n> remove a line from the new branches file.\n> checkout master. add another line to that file.\n> checkout new branch and attempt to merge.\n>\n> you should now see the point that may test case is at.\n\nYes, this is because automatic renaming detection fails\nwith this kind of toy examples. Git can't infer the file\nwas renamed because almost nothing is similar enough. Take\na look at the attached script and run it with 'sh test.sh'\nand 'sh test.sh real_test', and look at the difference.\n\n- Pieter\n\n#!/usr/bin/bish\nif test x$1 = x\nthen\n\tEXTRA_LINES=\"\"\nelse\n\tEXTRA_LINES=\"line2\\nline3\\nline4\\nline5\"\nfi\nFILE1=\"a\\n$EXTRA_LINES\"\nFILE2=\"a\\n$EXTRA_LINES\\nb\"\nFILE3=\"$EXTRA_LINES\\nb\"\nFILE4=\"a\\n$EXTRA_LINES\\nb\\nc\"\n\necho -e $FILE2\nrm -rf test_dir\nmkdir test_dir\ncd test_dir\ngit init\n\necho -e $FILE1 > file\ngit add file\ngit commit -am \"Initial\"\n\ngit checkout -b branch\ngit mv file a\nmkdir file\ngit mv a file/file\ngit commit -m \"Move\"\n\ngit checkout master\necho -e $FILE2 > file\ngit commit -am \"Add a line\"\n\ngit checkout branch\ngit merge master\n\necho -e $FILE3 > file/file\ngit commit -am \"Remove line\"\n\ngit checkout master\necho -e $FILE4 > file\ngit commit -am \"Add another line\"\n\ngit checkout branch\ngit merge master\n"},{"id":"107604","messageId":"81bfc67a0903101251r29e14154ud289646a1f5c20e0@mail.gmail.com","threadId":"18251","inReplyTo":"252A6411-2658-4DC6-A7F4-29CA3981F8FB@frim.nl","subject":"Re: BUG: git can't handle certain kinds of renames in merges","fromName":"Caleb Cushing","fromEmail":"xenoterracide@gmail.com","sentAt":"2009-03-10T19:51:00Z","receivedAt":"2009-03-10T19:51:00Z","isPatch":false,"sender":{"key":"xenoterracide@gmail.com","avatar":"https://gravatar.com/avatar/af3f0745dfa0ea9c4ee551d7d0a3cfe7ba8d229754c11678ab2ed23c3fa57065?d=mp&s=160"},"body":"On Tue, Mar 10, 2009 at 12:02 PM, Pieter de Bie <pieter@frim.nl> wrote:\n> ind of toy examples. Git can't infer the file\n> was renamed because almost nothing is similar enough. Take\n> a look at the attached script and run it with 'sh test.sh'\n> and 'sh test.sh real_test', and look at the difference.\n\nI've got a much bigger example(hundreds of lines, and dozens change at\na time)  which resolves in the same problem or worse with\ngit-tree-write errors. I'm trying to figure out now how to work around\nthis issue.\n\n-- \nCaleb Cushing\n\nhttp://xenoterracide.blogspot.com\n"}]}