{"thread":{"id":"32901","subject":"Cumulative \"git read-tree -m\" rejected with overwriting warning","startedAt":"2013-02-13T23:02:13Z","lastAt":"2013-02-13T23:40:24Z","messageCount":2,"participants":["Marcin Owsiany","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"209501","messageId":"20130213230213.GT20333@localhost","threadId":"32901","inReplyTo":null,"subject":"Cumulative \"git read-tree -m\" rejected with overwriting warning","fromName":"Marcin Owsiany","fromEmail":"marcin@owsiany.pl","sentAt":"2013-02-13T23:02:13Z","receivedAt":"2013-02-13T23:02:13Z","isPatch":false,"sender":{"key":"marcin@owsiany.pl","avatar":"https://avatars.githubusercontent.com/u/489420?v=4"},"body":"Hello,\n\nConsider the following use case:\n\n  git init\n  seq 0 9 > f\n  git add f\n  git commit -m start\n  \n  git checkout -b b1\n  perl -pi -e 's,0,b1,' f\n  git commit -a -m b1\n  \n  git checkout -b b2\n  perl -pi -e 's,9,b2,' f\n  git commit -a -m b2\n  \n  git checkout master\n  git merge b1 b1\n\nAs the changes to \"f\" don't conflict, the octopus merge deals with them\njust fine, and I get a merge in a single commit object.\n\n\nNow, let's say my b1 and b2 branches are a bit more special, and apart\nfrom the main contents (i.e. the \"f\" file), each branch contains a\ncouple of files with branch-specific metadata. The names of those files\nare the same in each branch.  (People familiar with topgit can probably\nguess I'm talking about topgit branches here.)\n\nI'd like to merge all such branches into \"master\" in one octopus-like\ncommit, but the metadata files introduce a conflict during simple\noctopus merge.  However I don't care about that metadata when the\nbranches are merged into \"master\", so I'm trying to write a script which\nwould do such merge while discarding the metadata files.\n\nThe problem is, I cannot get it to work, when two branches modify the\nsame file (like \"f\" above), even if the changes don't conflict. I get\neither:\n\nerror: Entry 'f' would be overwritten by merge. Cannot merge.\n - when trying to use the two-arg form of \"git read-tree -m -i\"\n\nor:\nf: needs merge\n - when trying to use the three-arg form\n\nAttached is the minimal test case that reproduces the problem.\n\nIt might just be that git-read-tree cannot do what I need, and I'm just\nmisinterpreting the meaning of:\n\n \"the index file saves and restores with all this information, so you\n can merge things incrementally,\"\n\nwhich I took to mean that I can read from multiple trees one by one\nbefore writing the tree.\n\nCould anyone give me some hints?\n\n-- \nMarcin Owsiany <marcin@owsiany.pl>              http://marcin.owsiany.pl/\nGnuPG: 2048R/02F946FC  35E9 1344 9F77 5F43 13DD  6423 DBF4 80C6 02F9 46FC\n\n\"Every program in development at MIT expands until it can read mail.\"\n                                                              -- Unknown\n"},{"id":"209502","messageId":"7v1ucj4wbb.fsf@alter.siamese.dyndns.org","threadId":"32901","inReplyTo":"20130213230213.GT20333@localhost","subject":"Re: Cumulative \"git read-tree -m\" rejected with overwriting warning","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-13T23:40:24Z","receivedAt":"2013-02-13T23:40:24Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marcin Owsiany <marcin@owsiany.pl> writes:\n\n>  \"the index file saves and restores with all this information, so you\n>  can merge things incrementally,\"\n>\n> which I took to mean that I can read from multiple trees one by one\n> before writing the tree.\n\nThat \"incrementally\" refers to \"after a three-way merge stops with\nconflicts in multiple files, you can start from file A, concentrate\nonly on that file, resolve it, and then go on to resolve conflicts\nin the next file B, continue, until you resolve the conflicts in the\nlast file Z\".  Until you resolve a single tree-way merge fully and\nwrite the results out as a tree, you cannot merge in the next tree.\n\nThat is why N-way octopus is internally implemented as a series of\nthree-way merges.\n"}]}