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

Failed shallow submodule clone for fixed SHA1 falls back to checking out HEAD

From
Sebastian Schuberth <sschuberth@gmail.com>
Date
Apr 18, 2017, 13:04 UTC
Message-ID
<605bb444-8d8c-7fea-d3b8-6f8414636d87@gmail.com>
Hi,
this is using "git version 2.12.2.windows.2" on Windows / "git version 2.12.2-639-g584f897" on Linux.
I have configured my superproject with .gitmodules saying
---8<---
[submodule "src/funTest/resources/projects/external/jgnash"]
       path = src/funTest/resources/projects/external/jgnash
       url = https://github.com/ccavanaugh/jgnash.git
       shallow = true
---8<---
and configured the submodule to checkout commit 2aa4cce7d7fd46164030f2b4d244c4b89e77f722 [1]. When doing a fresh clone of my superproject via "git clone --recursive" I get

---8<--- error: Server does not allow request for unadvertised object 2aa4cce7d7fd46164030f2b4d244c4b89e77f722 Fetched in submodule path 'src/funTest/resources/projects/external/jgnash', but it did not contain 2aa4cce7d7fd464030f2b4d244c4b89e77f722. Direct fetching of that commit failed. ---8<---

So far so good, it simply seems that GitHub does not support allowReachableSHA1InWant [2]. The interesting bit is that my submodule checkout still ends up being shallow, but poiting to HEAD:
---8<---
$ cd src/funTest/resources/projects/external/jgnash
$ git log
commit 12036fffb6c620515edd96416363fd1749b5d003 (grafted, HEAD -> master, origin/master, origin/HEAD)
Author: Craig Cavanaugh <jgnash.devel@gmail.com>
Date:   Tue Apr 18 05:33:06 2017 -0400
    Fix typos
---8<---
Wouldn't it make more sense to unshallow the submodule clone in this case and checkout the configured commit 2aa4cce7d7fd46164030f2b4d244c4b89e77f722 afterwards? At least I'd be getting what I asked for in that case, even if at the cost of additional network traffic. Because if I read [3] correctly, the command line option belonging to "submodule.<name>.shallow" is called "--[no-]recommend-shallow", i.e. it's only a recommendation, to falling back to a full clone should be fine.

[1] https://github.com/ccavanaugh/jgnash/commit/2aa4cce7d7fd46164030f2b4d244c4b89e77f722 [2] https://git-scm.com/docs/git-config#git-config-uploadpackallowReachableSHA1InWant [3] https://git-scm.com/docs/git-submodule

Regards, Sebastian

Next: Stefan Beller
Message 1 of 3 in “Failed shallow submodule clone for fixed SHA1 falls back to checking out HEAD”
  1. Sebastian SchuberthApr 18, 2017
  2. Fwd: Failed shallow submodule clone for fixed SHA1 falls back to checking out HEADStefan Beller, Apr 18, 2017
  3. Sebastian SchuberthApr 18, 2017

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.