From: "Antoine W. Campagna" <awe@frontmatec.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: RE: fatal: could not reset submodule index
Date: Thu, 14 Jun 2018 18:19:27 +0000 [thread overview]
Message-ID: <DB6PR0101MB2344D682511891E4E9528598D97D0@DB6PR0101MB2344.eurprd01.prod.exchangelabs.com> (raw)
On Wed, Jun 13, 2018 at 18:19, Antoine W. Campagna wrote:
> Here is the full reproduction instructions:
Newlines got mangled, making my message hard to read. Sorry.
Here is the corrected reproduction instructions:
# Create a repository
mkdir main
cd main
git init
touch main.txt
git add main.txt
git commit -a -m "Initial commit"
cd ..
# Create a second repository
mkdir sub
cd sub
git init
touch sub.txt
git add sub.txt
git commit -a -m "Initial commit of repo sub"
cd ..
# Add the second repository as submodule, on a separate branch
cd main
git branch with-submodule
git checkout with-submodule
git submodule add ../sub sub
git commit -a -m "Add submodule"
# Set main repo back to master branch (without the submodule)
git checkout master
cd ..
# Make a clone and checkout the branch
git clone main clone1
cd clone1
git checkout with-submodule
# Submodule is not automatically updated (sub folder is empty)
git submodule update --init --recursive
# Now the submodule content is there
# But I want to automatically update submodules when checking out a branch
cd ..
# Trying again, adding --recursive during clone
git clone --recursive main clone2
cd clone2
git checkout with-submodule
# Submodule is still not automatically updated (sub folder is empty)
git submodule update --init --recursive
cd ..
# Trying again, adding --recurse-submodules during checkout
git clone --recursive main clone3
cd clone3
git checkout --recurse-submodules with-submodule
# Fails with these error messages :
# fatal: not a git repository: ../.git/modules/sub
# fatal: could not reset submodule index
# It seems like Git tries to update the submodule but without having initialized the submodule cd ..
# Trying again with submodule.recurse
git config --global submodule.recurse true
git clone main clone4 cd clone4
git checkout with-submodule
# Submodule is still not automatically updated (sub folder is empty)
# It seems like submodule.recurse does not affect git clone
# Trying again with both submodule.recurse and --recursive
git config --global submodule.recurse true
git clone --recursive main clone5 cd clone5
git checkout with-submodule
# Fails with these error messages :
# fatal: not a git repository: ../.git/modules/sub
# fatal: could not reset submodule index
# Same issue as with "git checkout --recurse-submodules"
next reply other threads:[~2018-06-14 18:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-14 18:19 Antoine W. Campagna [this message]
2018-06-15 19:47 ` fatal: could not reset submodule index Stefan Beller
2018-06-18 13:57 ` Antoine W. Campagna
-- strict thread matches above, loose matches on Subject: below --
2018-06-13 22:17 Antoine W. Campagna
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=DB6PR0101MB2344D682511891E4E9528598D97D0@DB6PR0101MB2344.eurprd01.prod.exchangelabs.com \
--to=awe@frontmatec.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).