{"thread":{"id":"21924","subject":"subtree merge tries to merge into wrong directory","startedAt":"2009-12-10T03:41:03Z","lastAt":"2010-01-02T18:17:14Z","messageCount":6,"participants":["Nils Adermann","David Aguilar","Avery Pennarun","naderman@naderman.de"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"129672","messageId":"4B206DCF.90202@naderman.de","threadId":"21924","inReplyTo":null,"subject":"subtree merge tries to merge into wrong directory","fromName":"Nils Adermann","fromEmail":"naderman@naderman.de","sentAt":"2009-12-10T03:41:03Z","receivedAt":"2009-12-10T03:41:03Z","isPatch":false,"sender":{"key":"naderman@naderman.de","avatar":"https://gravatar.com/avatar/7b53fd135df4732d40488c0394fae263e128283081f2b833e3dc0a780b4b900d?d=mp&s=160"},"body":"Following \nhttp://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html \nI have subtree merged a 3rd party library (ezc-reflection) into my \nrepository (pflow). The prefix I used was lib/ezc/trunk/Reflection. Now \nthere have been changes to ezc-reflection but merging them into my \nrepository fails. The merge is attempted in example/ rather than \nlib/ezc/trunk/Reflection.\n\nI originally set this up with:\n\ngit remote add -f ezc-reflection /path/to/ezc-reflection\ngit merge -s ours --no-commit ezc-reflection/master\ngit read-tree --prefix=lib/ezc/trunk/Reflection -u ezc-reflection/master\n\nReproduce my problem by executing the following:\n\ngit clone git://github.com/naderman/pflow.git\ncd pflow\ngit reset --hard f3e001e3\ngit fetch git://github.com/naderman/ezc-reflection.git master\ngit merge -s subtree FETCH_HEAD\n\nAs you see this results in:\n\nCONFLICT (delete/modify): example/src/doc_comment_parser.php deleted in \nHEAD and modified in FETCH_HEAD. Version FETCH_HEAD of \nexample/src/doc_comment_parser.php left in tree.\nAutomatic merge failed; fix conflicts and then commit the result.\n\nAs long as I don't make any changes to lib/ezc/trunk/Reflection that I \nwant to merge I can work around this by simply repeating my original \nprocess like this:\n\ngit clone git://github.com/naderman/pflow.git\ncd pflow\ngit reset --hard f3e001e3\ngit fetch git://github.com/naderman/ezc-reflection.git master\ngit merge -s ours --no-commit FETCH_HEAD\ngit rm -r lib/ezc/trunk/Reflection/\ngit read-tree --prefix=lib/ezc/trunk/Reflection/ -u FETCH_HEAD\n\nWhy does this problem occur and how can I get the merge to work properly?\n\nCheers,\nNils Adermann\n"},{"id":"129673","messageId":"20091210042008.GA3398@gmail.com","threadId":"21924","inReplyTo":"4B206DCF.90202@naderman.de","subject":"Re: subtree merge tries to merge into wrong directory","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2009-12-10T04:20:08Z","receivedAt":"2009-12-10T04:20:08Z","isPatch":false,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Thu, Dec 10, 2009 at 04:41:03AM +0100, Nils Adermann wrote:\n> Following  \n> http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html \n> I have subtree merged a 3rd party library (ezc-reflection) into my  \n> repository (pflow). The prefix I used was lib/ezc/trunk/Reflection. Now  \n> there have been changes to ezc-reflection but merging them into my  \n> repository fails. The merge is attempted in example/ rather than  \n> lib/ezc/trunk/Reflection.\n>\n> I originally set this up with:\n>\n> git remote add -f ezc-reflection /path/to/ezc-reflection\n> git merge -s ours --no-commit ezc-reflection/master\n> git read-tree --prefix=lib/ezc/trunk/Reflection -u ezc-reflection/master\n>\n> Reproduce my problem by executing the following:\n>\n> git clone git://github.com/naderman/pflow.git\n> cd pflow\n> git reset --hard f3e001e3\n> git fetch git://github.com/naderman/ezc-reflection.git master\n> git merge -s subtree FETCH_HEAD\n>\n> As you see this results in:\n>\n> CONFLICT (delete/modify): example/src/doc_comment_parser.php deleted in  \n> HEAD and modified in FETCH_HEAD. Version FETCH_HEAD of  \n> example/src/doc_comment_parser.php left in tree.\n> Automatic merge failed; fix conflicts and then commit the result.\n>\n> As long as I don't make any changes to lib/ezc/trunk/Reflection that I  \n> want to merge I can work around this by simply repeating my original  \n> process like this:\n>\n> git clone git://github.com/naderman/pflow.git\n> cd pflow\n> git reset --hard f3e001e3\n> git fetch git://github.com/naderman/ezc-reflection.git master\n> git merge -s ours --no-commit FETCH_HEAD\n> git rm -r lib/ezc/trunk/Reflection/\n> git read-tree --prefix=lib/ezc/trunk/Reflection/ -u FETCH_HEAD\n>\n> Why does this problem occur and how can I get the merge to work properly?\n\nI'm not sure, but maybe you can try git-subtree?\nIt makes this stuff easier for mere mortals.\n\nhttp://github.com/apenwarr/git-subtree/\n\nYou might need to start redo your repo, but several people have\nhad good success with git-subtree.\n\n\n-- \n\t\tDavid\n"},{"id":"129674","messageId":"4B207866.2010400@naderman.de","threadId":"21924","inReplyTo":"20091210042008.GA3398@gmail.com","subject":"Re: subtree merge tries to merge into wrong directory","fromName":"Nils Adermann","fromEmail":"naderman@naderman.de","sentAt":"2009-12-10T04:26:14Z","receivedAt":"2009-12-10T04:26:14Z","isPatch":false,"sender":{"key":"naderman@naderman.de","avatar":"https://gravatar.com/avatar/7b53fd135df4732d40488c0394fae263e128283081f2b833e3dc0a780b4b900d?d=mp&s=160"},"body":"David Aguilar schrieb:\n> On Thu, Dec 10, 2009 at 04:41:03AM +0100, Nils Adermann wrote:\n>   \n>> Following  \n>> http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html \n>> I have subtree merged a 3rd party library (ezc-reflection) into my  \n>> repository (pflow). The prefix I used was lib/ezc/trunk/Reflection. Now  \n>> there have been changes to ezc-reflection but merging them into my  \n>> repository fails. The merge is attempted in example/ rather than  \n>> lib/ezc/trunk/Reflection.\n>>\n>> I originally set this up with:\n>>\n>> git remote add -f ezc-reflection /path/to/ezc-reflection\n>> git merge -s ours --no-commit ezc-reflection/master\n>> git read-tree --prefix=lib/ezc/trunk/Reflection -u ezc-reflection/master\n>>\n>> Reproduce my problem by executing the following:\n>>\n>> git clone git://github.com/naderman/pflow.git\n>> cd pflow\n>> git reset --hard f3e001e3\n>> git fetch git://github.com/naderman/ezc-reflection.git master\n>> git merge -s subtree FETCH_HEAD\n>>\n>> As you see this results in:\n>>\n>> CONFLICT (delete/modify): example/src/doc_comment_parser.php deleted in  \n>> HEAD and modified in FETCH_HEAD. Version FETCH_HEAD of  \n>> example/src/doc_comment_parser.php left in tree.\n>> Automatic merge failed; fix conflicts and then commit the result.\n>>\n>> As long as I don't make any changes to lib/ezc/trunk/Reflection that I  \n>> want to merge I can work around this by simply repeating my original  \n>> process like this:\n>>\n>> git clone git://github.com/naderman/pflow.git\n>> cd pflow\n>> git reset --hard f3e001e3\n>> git fetch git://github.com/naderman/ezc-reflection.git master\n>> git merge -s ours --no-commit FETCH_HEAD\n>> git rm -r lib/ezc/trunk/Reflection/\n>> git read-tree --prefix=lib/ezc/trunk/Reflection/ -u FETCH_HEAD\n>>\n>> Why does this problem occur and how can I get the merge to work properly?\n>>     \n>\n> I'm not sure, but maybe you can try git-subtree?\n> It makes this stuff easier for mere mortals.\n>\n> http://github.com/apenwarr/git-subtree/\n>\n> You might need to start redo your repo, but several people have\n> had good success with git-subtree.\n>   \nI actually tried that and I get the exact same problem. From what I \nunderstand git-subtree really doesn't do anything different than what I \ndo anyway.\n"},{"id":"129696","messageId":"32541b130912100638v1f701183w909367cd97c8325@mail.gmail.com","threadId":"21924","inReplyTo":"4B206DCF.90202@naderman.de","subject":"Re: subtree merge tries to merge into wrong directory","fromName":"Avery Pennarun","fromEmail":"apenwarr@gmail.com","sentAt":"2009-12-10T14:38:13Z","receivedAt":"2009-12-10T14:38:13Z","isPatch":false,"sender":{"key":"apenwarr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/20592?v=4"},"body":"On Wed, Dec 9, 2009 at 10:41 PM, Nils Adermann <naderman@naderman.de> wrote:\n> Following\n> http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html\n> I have subtree merged a 3rd party library (ezc-reflection) into my\n> repository (pflow). The prefix I used was lib/ezc/trunk/Reflection. Now\n> there have been changes to ezc-reflection but merging them into my\n> repository fails. The merge is attempted in example/ rather than\n> lib/ezc/trunk/Reflection.\n\nThe auto-guessing feature of \"merge -s subtree\" doesn't always work.\nThe 'pu' branch of git has some patches which allow you to use a\ncommand line like\n\n    git merge -Xsubtree=lib/ezc/trunk/Reflection\n\nIf you're nervous about using all of 'pu', try building git's 'master'\nafter merging from commit 0354b06927a1220b696a5ee1004a8f061ba9b153.\n\nEventually my git-subtree tool will use this automatically, but it's\nobviously not much use until the patches hit a released version of\ngit.\n\nHope this helps.\n\nAvery\n"},{"id":"129996","messageId":"c10155f8a7a2dd451f0b74e323f3a989.squirrel@www.naderman.de","threadId":"21924","inReplyTo":"32541b130912100638v1f701183w909367cd97c8325@mail.gmail.com","subject":"Re: subtree merge tries to merge into wrong directory","fromName":"","fromEmail":"naderman@naderman.de","sentAt":null,"receivedAt":"2009-12-16T16:53:00Z","isPatch":false,"sender":{"key":"naderman@naderman.de","avatar":"https://gravatar.com/avatar/7b53fd135df4732d40488c0394fae263e128283081f2b833e3dc0a780b4b900d?d=mp&s=160"},"body":"Avery Pennarun wrote:\n> On Wed, Dec 9, 2009 at 10:41 PM, Nils Adermann <naderman@naderman.de>\nwrote:\n>> Following\n>> http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html\n>> I have subtree merged a 3rd party library (ezc-reflection) into my\n>> repository (pflow). The prefix I used was lib/ezc/trunk/Reflection. Now\n>> there have been changes to ezc-reflection but merging them into my\n>> repository fails. The merge is attempted in example/ rather than\n>> lib/ezc/trunk/Reflection.\n>\n> The auto-guessing feature of \"merge -s subtree\" doesn't always work.\n> The 'pu' branch of git has some patches which allow you to use a\n> command line like\n>\n>     git merge -Xsubtree=lib/ezc/trunk/Reflection\n>\n> If you're nervous about using all of 'pu', try building git's 'master'\n> after merging from commit 0354b06927a1220b696a5ee1004a8f061ba9b153.\nSo I finally got around to trying this. This was my first result:\n\n$ git merge -Xsubtree=lib/ezc/trunk/Reflection/ FETCH_HEAD\nfatal: entry  not found in tree 60270661e0d2a5ee03b24609fac5c6d00d048988\n\nInterestingly the following works, as in merges correctly into\nlib/ezc/trunk/Reflection/. The \"arbitrary\" part can be set to anything it\njust needs to be set. No directory with that name is created.\n\n$ git merge --strategy-option=subtree=arbitrary FETCH_HEAD\nMerge made by recursive.\n .../trunk/Reflection/src/doc_comment_parser.php    |   38\n++++++++++---------\n 1 files changed, 20 insertions(+), 18 deletions(-)\n\nWhile the following results in the same issue I originally had with -s\nstrategy\n\n$ git merge --strategy-option=subtree FETCH_HEAD\nCONFLICT (delete/modify): example/src/doc_comment_parser.php deleted in\nHEAD and modified in FETCH_HEAD. Version FETCH_HEAD of\nexample/src/doc_comment_parser.php left in tree.\nAutomatic merge failed; fix conflicts and then commit the result.\n\nI'm not sure why this is happening, but the\n--strategy-option=subtree=arbitrary solves my issue for now.\n\nCheers\nNils\n"},{"id":"130692","messageId":"4B3F8DAA.8090908@naderman.de","threadId":"21924","inReplyTo":"c10155f8a7a2dd451f0b74e323f3a989.squirrel@www.naderman.de","subject":"Re: subtree merge tries to merge into wrong directory","fromName":"Nils Adermann","fromEmail":"naderman@naderman.de","sentAt":"2010-01-02T18:17:14Z","receivedAt":"2010-01-02T18:17:14Z","isPatch":false,"sender":{"key":"naderman@naderman.de","avatar":"https://gravatar.com/avatar/7b53fd135df4732d40488c0394fae263e128283081f2b833e3dc0a780b4b900d?d=mp&s=160"},"body":"naderman@naderman.de schrieb:\n> So I finally got around to trying this. This was my first result:\n>\n> $ git merge -Xsubtree=lib/ezc/trunk/Reflection/ FETCH_HEAD\n> fatal: entry  not found in tree 60270661e0d2a5ee03b24609fac5c6d00d048988\n>   \nTurns out that only happens because of the trailing slash. \nlib/ezc/trunk/Reflection works reliably.\n\nNils\n"}]}