git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: subtree merge tries to merge into wrong directory

From
naderman@naderman.de <naderman@naderman.de>
Date
Dec 16, 2009, 16:53 UTC
Message-ID
<c10155f8a7a2dd451f0b74e323f3a989.squirrel@www.naderman.de>
In-Reply-To
<32541b130912100638v1f701183w909367cd97c8325@mail.gmail.com>
Avery Pennarun wrote:
> On Wed, Dec 9, 2009 at 10:41 PM, Nils Adermann <naderman@naderman.de>
wrote:
Show 16 quoted lines
>> Following
>> http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html
>> I have subtree merged a 3rd party library (ezc-reflection) into my
>> repository (pflow). The prefix I used was lib/ezc/trunk/Reflection. Now
>> there have been changes to ezc-reflection but merging them into my
>> repository fails. The merge is attempted in example/ rather than
>> lib/ezc/trunk/Reflection.
>
> The auto-guessing feature of "merge -s subtree" doesn't always work.
> The 'pu' branch of git has some patches which allow you to use a
> command line like
>
>     git merge -Xsubtree=lib/ezc/trunk/Reflection
>
> If you're nervous about using all of 'pu', try building git's 'master'
> after merging from commit 0354b06927a1220b696a5ee1004a8f061ba9b153.
So I finally got around to trying this. This was my first result:

$ git merge -Xsubtree=lib/ezc/trunk/Reflection/ FETCH_HEAD fatal: entry not found in tree 60270661e0d2a5ee03b24609fac5c6d00d048988

Interestingly the following works, as in merges correctly into lib/ezc/trunk/Reflection/. The "arbitrary" part can be set to anything it just needs to be set. No directory with that name is created.

$ git merge --strategy-option=subtree=arbitrary FETCH_HEAD
Merge made by recursive.
 .../trunk/Reflection/src/doc_comment_parser.php    |   38
++++++++++---------
 1 files changed, 20 insertions(+), 18 deletions(-)

While the following results in the same issue I originally had with -s strategy

$ git merge --strategy-option=subtree FETCH_HEAD CONFLICT (delete/modify): example/src/doc_comment_parser.php deleted in HEAD and modified in FETCH_HEAD. Version FETCH_HEAD of example/src/doc_comment_parser.php left in tree. Automatic merge failed; fix conflicts and then commit the result.

I'm not sure why this is happening, but the --strategy-option=subtree=arbitrary solves my issue for now.

Cheers Nils

Previous: Avery PennarunNext: Nils Adermann
Message 5 of 6 in “subtree merge tries to merge into wrong directory”
  1. Nils AdermannDec 10, 2009
  2. David AguilarDec 10, 2009
  3. Nils AdermannDec 10, 2009
  4. Avery PennarunDec 10, 2009
  5. naderman@naderman.deDec 16, 2009
  6. Nils AdermannJan 2, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.