Git development
 help / color / mirror / Atom feed
* subtree merge tries to merge into wrong directory
@ 2009-12-10  3:41 Nils Adermann
  2009-12-10  4:20 ` David Aguilar
  2009-12-10 14:38 ` Avery Pennarun
  0 siblings, 2 replies; 6+ messages in thread
From: Nils Adermann @ 2009-12-10  3:41 UTC (permalink / raw)
  To: git

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.

I originally set this up with:

git remote add -f ezc-reflection /path/to/ezc-reflection
git merge -s ours --no-commit ezc-reflection/master
git read-tree --prefix=lib/ezc/trunk/Reflection -u ezc-reflection/master

Reproduce my problem by executing the following:

git clone git://github.com/naderman/pflow.git
cd pflow
git reset --hard f3e001e3
git fetch git://github.com/naderman/ezc-reflection.git master
git merge -s subtree FETCH_HEAD

As you see this results in:

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.

As long as I don't make any changes to lib/ezc/trunk/Reflection that I 
want to merge I can work around this by simply repeating my original 
process like this:

git clone git://github.com/naderman/pflow.git
cd pflow
git reset --hard f3e001e3
git fetch git://github.com/naderman/ezc-reflection.git master
git merge -s ours --no-commit FETCH_HEAD
git rm -r lib/ezc/trunk/Reflection/
git read-tree --prefix=lib/ezc/trunk/Reflection/ -u FETCH_HEAD

Why does this problem occur and how can I get the merge to work properly?

Cheers,
Nils Adermann

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: subtree merge tries to merge into wrong directory
  2009-12-10  3:41 subtree merge tries to merge into wrong directory Nils Adermann
@ 2009-12-10  4:20 ` David Aguilar
  2009-12-10  4:26   ` Nils Adermann
  2009-12-10 14:38 ` Avery Pennarun
  1 sibling, 1 reply; 6+ messages in thread
From: David Aguilar @ 2009-12-10  4:20 UTC (permalink / raw)
  To: Nils Adermann; +Cc: git

On Thu, Dec 10, 2009 at 04:41:03AM +0100, Nils Adermann wrote:
> 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.
>
> I originally set this up with:
>
> git remote add -f ezc-reflection /path/to/ezc-reflection
> git merge -s ours --no-commit ezc-reflection/master
> git read-tree --prefix=lib/ezc/trunk/Reflection -u ezc-reflection/master
>
> Reproduce my problem by executing the following:
>
> git clone git://github.com/naderman/pflow.git
> cd pflow
> git reset --hard f3e001e3
> git fetch git://github.com/naderman/ezc-reflection.git master
> git merge -s subtree FETCH_HEAD
>
> As you see this results in:
>
> 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.
>
> As long as I don't make any changes to lib/ezc/trunk/Reflection that I  
> want to merge I can work around this by simply repeating my original  
> process like this:
>
> git clone git://github.com/naderman/pflow.git
> cd pflow
> git reset --hard f3e001e3
> git fetch git://github.com/naderman/ezc-reflection.git master
> git merge -s ours --no-commit FETCH_HEAD
> git rm -r lib/ezc/trunk/Reflection/
> git read-tree --prefix=lib/ezc/trunk/Reflection/ -u FETCH_HEAD
>
> Why does this problem occur and how can I get the merge to work properly?

I'm not sure, but maybe you can try git-subtree?
It makes this stuff easier for mere mortals.

http://github.com/apenwarr/git-subtree/

You might need to start redo your repo, but several people have
had good success with git-subtree.


-- 
		David

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: subtree merge tries to merge into wrong directory
  2009-12-10  4:20 ` David Aguilar
@ 2009-12-10  4:26   ` Nils Adermann
  0 siblings, 0 replies; 6+ messages in thread
From: Nils Adermann @ 2009-12-10  4:26 UTC (permalink / raw)
  To: David Aguilar; +Cc: git

David Aguilar schrieb:
> On Thu, Dec 10, 2009 at 04:41:03AM +0100, Nils Adermann wrote:
>   
>> 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.
>>
>> I originally set this up with:
>>
>> git remote add -f ezc-reflection /path/to/ezc-reflection
>> git merge -s ours --no-commit ezc-reflection/master
>> git read-tree --prefix=lib/ezc/trunk/Reflection -u ezc-reflection/master
>>
>> Reproduce my problem by executing the following:
>>
>> git clone git://github.com/naderman/pflow.git
>> cd pflow
>> git reset --hard f3e001e3
>> git fetch git://github.com/naderman/ezc-reflection.git master
>> git merge -s subtree FETCH_HEAD
>>
>> As you see this results in:
>>
>> 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.
>>
>> As long as I don't make any changes to lib/ezc/trunk/Reflection that I  
>> want to merge I can work around this by simply repeating my original  
>> process like this:
>>
>> git clone git://github.com/naderman/pflow.git
>> cd pflow
>> git reset --hard f3e001e3
>> git fetch git://github.com/naderman/ezc-reflection.git master
>> git merge -s ours --no-commit FETCH_HEAD
>> git rm -r lib/ezc/trunk/Reflection/
>> git read-tree --prefix=lib/ezc/trunk/Reflection/ -u FETCH_HEAD
>>
>> Why does this problem occur and how can I get the merge to work properly?
>>     
>
> I'm not sure, but maybe you can try git-subtree?
> It makes this stuff easier for mere mortals.
>
> http://github.com/apenwarr/git-subtree/
>
> You might need to start redo your repo, but several people have
> had good success with git-subtree.
>   
I actually tried that and I get the exact same problem. From what I 
understand git-subtree really doesn't do anything different than what I 
do anyway.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: subtree merge tries to merge into wrong directory
  2009-12-10  3:41 subtree merge tries to merge into wrong directory Nils Adermann
  2009-12-10  4:20 ` David Aguilar
@ 2009-12-10 14:38 ` Avery Pennarun
  2009-12-16 18:05   ` naderman
  1 sibling, 1 reply; 6+ messages in thread
From: Avery Pennarun @ 2009-12-10 14:38 UTC (permalink / raw)
  To: Nils Adermann; +Cc: git

On Wed, Dec 9, 2009 at 10:41 PM, Nils Adermann <naderman@naderman.de> wrote:
> 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.

Eventually my git-subtree tool will use this automatically, but it's
obviously not much use until the patches hit a released version of
git.

Hope this helps.

Avery

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: subtree merge tries to merge into wrong directory
  2009-12-10 14:38 ` Avery Pennarun
@ 2009-12-16 18:05   ` naderman
  2010-01-02 18:17     ` Nils Adermann
  0 siblings, 1 reply; 6+ messages in thread
From: naderman @ 2009-12-16 18:05 UTC (permalink / raw)
  To: Avery Pennarun; +Cc: git

Avery Pennarun wrote:
> On Wed, Dec 9, 2009 at 10:41 PM, Nils Adermann <naderman@naderman.de>
wrote:
>> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: subtree merge tries to merge into wrong directory
  2009-12-16 18:05   ` naderman
@ 2010-01-02 18:17     ` Nils Adermann
  0 siblings, 0 replies; 6+ messages in thread
From: Nils Adermann @ 2010-01-02 18:17 UTC (permalink / raw)
  To: Avery Pennarun; +Cc: git

naderman@naderman.de schrieb:
> 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
>   
Turns out that only happens because of the trailing slash. 
lib/ezc/trunk/Reflection works reliably.

Nils

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-01-02 18:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-10  3:41 subtree merge tries to merge into wrong directory Nils Adermann
2009-12-10  4:20 ` David Aguilar
2009-12-10  4:26   ` Nils Adermann
2009-12-10 14:38 ` Avery Pennarun
2009-12-16 18:05   ` naderman
2010-01-02 18:17     ` Nils Adermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox