Reputation: 103
I have a git repos A and B in a Visual Studio Team Services Project. B is a submodule of A with the following config in .gitmodules:
[submodule "my_submodule"]
path = somefolder/my_submodule
url = https://xxx.visualstudio.com/xxx/_git/B
If I do a build with the option Repository/Checkout Submodules I get the following error:
Repository type=TfsGit
localPath=C:\a\1\s
clean=False
sourceBranch=refs/heads/submoduletest
sourceVersion=0378dd86db31e4d7bff8de86a482b3d8e72dd3ba
Syncing repository: A (Git)
repository url=https://xxx.visualstudio.com/_git/A
checkoutSubmodules=True
Starting clone
Checking out 0378dd86db31e4d7bff8de86a482b3d8e72dd3ba to C:\a\1\s with submodules
Checked out branch refs/heads/submoduletest for repository A at commit 0378dd86db31e4d7bff8de86a482b3d8e72dd3ba
##[error]LibGit2Sharp.NotFoundException: Failed to resolve path 'C:/a/1/s/xxx/somefolder/my_submodule/.git': The system cannot find the path specified.
##[error] at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
##[error] at LibGit2Sharp.SubmoduleCollection.Update(String name, SubmoduleUpdateOptions options)
##[error] at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.DoUpdateSubmodules(Repository repository, Int32 maxRecursionDepth, Int32 currentRecursionDepth, String username, String password, CancellationToken cancellationToken)
##[error] at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.UpdateSubmodules(ITaskEndpoint endpoint, Repository repository, Int32 maxRecursionDepth, CancellationToken cancellationToken)
##[error] at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.SyncAndCheckout(Boolean cleanRepository, String sourceBranch, String sourceVersion, Boolean checkoutSubmodules, CancellationToken cancellationToken)
##[error] at Microsoft.TeamFoundation.DistributedTask.Plugin.Build.GitSourceProvider.<>c__DisplayClass3_0.<PrepareRepositoryAsync>b__0()
##[error]Microsoft.TeamFoundation.DistributedTask.Agent.Common.AgentExecutionTerminationException: Prepare repository failed with exception. ---> LibGit2Sharp.NotFoundException: Failed to resolve path 'C:/a/1/s/xxx/somefolder/my_submodule/.git': The system cannot find the path specified.
##[error] at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
##[error] at LibGit2Sharp.SubmoduleCollection.Update(String name, SubmoduleUpdateOptions options)
##[error] at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.DoUpdateSubmodules(Repository repository, Int32 maxRecursionDepth, Int32 currentRecursionDepth, String username, String password, CancellationToken cancellationToken)
##[error] at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.UpdateSubmodules(ITaskEndpoint endpoint, Repository repository, Int32 maxRecursionDepth, CancellationToken cancellationToken)
##[error] at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.GitHelper.SyncAndCheckout(Boolean cleanRepository, String sourceBranch, String sourceVersion, Boolean checkoutSubmodules, CancellationToken cancellationToken)
##[error] at Microsoft.TeamFoundation.DistributedTask.Plugin.Build.GitSourceProvider.<>c__DisplayClass3_0.<PrepareRepositoryAsync>b__0()
##[error] --- End of inner exception stack trace ---
##[error] at Microsoft.TeamFoundation.DistributedTask.Plugin.Build.GitSourceProvider.<>c__DisplayClass3_0.<PrepareRepositoryAsync>b__0()
##[error] at System.Threading.Tasks.Task.Execute()
The interesting error message seems to be:
LibGit2Sharp.NotFoundException: Failed to resolve path 'C:/a/1/s/xxx/somefolder/my_submodule/.git'
Doing a git clone xxx/A --recursive on my maschine works.
The fantastic docs point to an auth problems: https://www.visualstudio.com/en-us/docs/build/define/repository
But this says nothing about auth and even using a relative path in .gitmodules does not result in a different error message.
Any ideas?
For testing purposes I used a branch. I merged the changes (adding submodule) to master and retried - now with the following error:
##[error]LibGit2Sharp.NotFoundException: Object not found - no matching loose object (4fa408bc7b29e87b7032e0f78998516ff4a4da00)
That hash is the HEAD of my submodule - clearly available.
Upvotes: 1
Views: 1989
Reputation: 103
@eddie-msft was right with his comment: there was a folder with the same name on master. The checkout to my test branch did not remove the folder. While this works when I do it locally, VS Team Serivices seems to have a problem with that.
But there was another problem: Contrary to the documentation, I hat to provide the full url to the submodule (https://xxx.visualstudio.com/xxx/_git/B). The documentation states that I should use a relative url (../B or ../../B - its a guessing game) but that does not work.
Upvotes: 1
Reputation: 29968
There is some issue with your .gitmodules file. Usually, the path in the file should be your submodule repository name("B" in your scenario).
Upvotes: 0