On Mon, Jun 20, 2016 at 01:06:39PM +0000, Istvan Zakar wrote:
> 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). Can I somehow tell to fetch that exact commit I need for my 
> superproject?

Maybe. http://stackoverflow.com/questions/2144406/git-shallow-submodules
gives a good overview of this problem.

git fetches a branch and is shallow from that branch, which might be an
other sha1 than the one the submodule points to, (as you say). This
is/was one of the drawbacks with this method. However the since git 2.8,
git will try to fetch the sha1 direct (and not the branch). So then it
will work, if(!), the server supports direct access to sha1. This was
previously not allowed due to security concerns (if I recall correctly).

So the answer is, yes this will work if you've a recent version of git
and support on the server side for doing this. Unfortunately I'm not
sure which git version is needed on the server side for this to work.

-- 
Fredrik Gustafsson

phone: +46 733-608274
e-mail: iv...@iveqy.com
website: http://www.iveqy.com
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to