Re: Problem with --shallow-submodules option
- From
Stefan Beller <sbeller@google.com>
- Date
- Jun 20, 2016, 17:45 UTC
- Message-ID
- <CAGZ79kZyEzp92JP_Bp2te1XO=PB0+fwFn57MrBPuWe25PQKOog@mail.gmail.com>
- In-Reply-To
- <loom.20160620T145755-931@post.gmane.org>
On Mon, Jun 20, 2016 at 6:06 AM, Istvan Zakar <istvan.zakar@gmail.com> wrote:
Show 8 quoted lines
> Hello, > > I'm working on a relatively big project with many submodules. During > cloning for testing I tried to decrease the amount of data need to be > fetched from the server by using --shallow-submodules option in the clone > command. It seems to check out the tip of the remote repo, and if it's not > the commit registered in the superproject the submodule update fails > (obviously).
Yes that is broken as the depth of a submodule is counted from its own HEAD not from the superprojects sha1 as it should.
So it does
git clone --depth=1 <submodule-url> <submodule-path>
if HEAD != recorded gitlink sha1,
git fetch <recorded gitlink sha1>git checkout <recorded gitlink sha1>
> Can I somehow tell to fetch that exact commit I need for my > superproject?
Some servers support fetching by direct sha1, which is what we make use of here, then it sort-of works.
If the server doesn't support the capability to fetch an arbitrary sha1, the submodule command fails, with a message such as
error: no such remote ref $sha1
Fetched in submodule path '<submodule>', but it did not contain
$sha1. Direct fetching of that commit failed.So if it breaks for you now, I would suggest not using that switch, I don't think there is a quick workaround.
> > Thanks, > Istvan
Thanks, Stefan
Show 5 quoted lines
> > -- > To unsubscribe from this list: send the line "unsubscribe git" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html