Search code examples
gitgit-submodulestfs-2015

Git submodules are not shown as folder in parent in TFS


I have a Git repo that contains another repo as submodule in TFS. The submodule was added with this command:

git submodule add https://myurl/base base

When I clone the parent repository my local copy works fine. I can see the submodule and can access it.

But in TFS 2015 my submodule is not accessible from the parent. If i click base (which should be a folder or a link to the submodule) i only see a checksum, it looks like this:

TFS Screenshot

What am I missing? Or is this a problem with TFS?


Solution

  • A submodule's content is not stored in the "parent" repo[1]. TFS doesn't follow the submodule link to fetch the content. You can say it's a limitation of TFS (and AFAIK any git-hosting software), but not an unexpected one in my opinion[2]. I never looked closely enough to be sure, but I would assume the hash it displays is the commit hash at which you would find the excluded content in the submodule repo.


    [1] : Locally in your work tree, it looks mostly like everything is in your repo - because that's the illusion submodules create by having your work tree span multiple repos. But the parent repo database - the part that's sent to a remote like TFS - contains only a reference to the other repo.

    [2] : In general it can't even be assumed that the remote would have access to fetch from an arbitrary "other repo" that might be listed as a submodule.