All of lore.kernel.org
 help / color / mirror / Atom feed
* directory / submodule merge conflcts
@ 2008-07-12 16:01 Mark Levedahl
  0 siblings, 0 replies; only message in thread
From: Mark Levedahl @ 2008-07-12 16:01 UTC (permalink / raw)
  To: Git Mailing List

Over time, I have converted a number of subdirectories in a main project 
into submodules, while maintaining the complete pathnames intact. Thus, 
only git knows that an object at code/dir1 is a submodule or a 
subdirectory of the superproject.

git has trouble merging branches across the above boundaries, the script 
below demonstrates the issue. I cannot merge the main branch and a 
branch that occurred before conversion to a submodule.

Paraphrasing the script, the formula is
    - create a superproject with a subdirectory (sub1)
    - on master, convert sub1 to a submodule (no other changes)
    - on branch base (before sub1 conversion to a submodule), change a 
file not in sub1 (no other changes)
    - merge master into base - failure

The actual reported error message is:
fatal: cannot read object b500f4d0c6aaf40a0251da35b82c0fa5c57b6503 
'sub1~master': It is a submodule!
Merge with strategy recursive failed.

Any ideas or hints on how to improve this would be greatly appreciated.

Thanks,
Mark

#!/bin/sh
#
# demonstrate issue with directory / submodule (D/S) conflict problem

mkdir dsprob || exit
cd dsprob
git init
mkdir sub1
echo hi > foo
echo hi1 > sub1/foo
git add .
git commit -m "Create base"
git checkout -b base
echo bye >> foo
git add .
git commit -m "Modify base"
git checkout master

# make sub1 a submodule
git rm -r -f sub1
git commit -m "removed sub1 directory"
git checkout base sub1
git reset
cd sub1
git init
git add .
git commit -m "Start sub1 as its own project"
cd ..
mv sub1 sub1_repo
git submodule add "$(pwd)/sub1_repo" sub1
git commit -m "Added sub1 as a submodule"

# now, go back to base and try to merge
rm -rf sub1
git checkout -f base
git merge master

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-07-12 16:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-12 16:01 directory / submodule merge conflcts Mark Levedahl

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.