All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Levedahl <mlevedahl@verizon.net>
To: Git Mailing List <git@vger.kernel.org>
Subject: directory / submodule merge conflcts
Date: Sat, 12 Jul 2008 12:01:37 -0400	[thread overview]
Message-ID: <4878D561.8090009@verizon.net> (raw)

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

                 reply	other threads:[~2008-07-12 16:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4878D561.8090009@verizon.net \
    --to=mlevedahl@verizon.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.