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

Error fetching submodule from submodule

From
JRJesper Rønn-Jensen <jesperrr@gmail.com>
Date
Mar 7, 2019, 11:07 UTC
Message-ID
<CAL-rKu6AcyHdrCsVikwQxTgKHgtV86+BeHOv_sTSu-jvwME75Q@mail.gmail.com>

Hi I think I may have found an error in the way git handles a submodule's submodule. Read further for the example (extracted from a real project).

* I have a main repository which has some submodules defined.
* One of the submodules is a common submodule which is also included
in one of the other submodules
* When running `git fetch --recurse-submodules` I get an error.
The error is "Could not access submodule 'common_submodule'"

``` $ git --version git version 2.21.0 ```

I created the following script to show (using Git-extras `git create` to simplify):

``` #!/usr/bin/env bash

if [ "$FORCE" = 'true' ]; then
  rm -rf submodule_experiment
fi
if [ -e submodule_experiment ]; then
  echo FATAL: folder submodule_experiment must not exist. Remove with FORCE=true
  exit 9
fi

mkdir submodule_experiment pushd submodule_experiment

git setup common_submodule pushd common_submodule echo 'common file' > common.txt git add common.txt git commit -m 'a file in the common submodule'

popd

git setup other_submodule pushd other_submodule git submodule add ../common_submodule git commit -m 'added submodule to other_submodule'

popd

git setup main_repos pushd main_repos git submodule add ../common_submodule git commit -m 'added submodule to main_repos'

git submodule add ../other_submodule git commit -m 'added other_submodule to main_repos'

# This line fails with error code 1 "Could not access submodule 'common_submodule'" git fetch --recurse-submodules

```

Question: Is this a bug in Git or am I declaring the common submodule in an incorrect way?

-- 
Jesper Rønn-Jensen
Nine A/S
Mobile: +45 2989 1822
Blog http://justaddwater.dk/
jesperrr@gmail.com (Private e-mail and Google Talk IM)
Next: Jeff King
Message 1 of 3 in “Error fetching submodule from submodule”
  1. Jesper Rønn-JensenMar 7, 2019
  2. Jeff KingMar 7, 2019
  3. Jesper Rønn-JensenMar 8, 2019

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.