Updating a submodule using GitHttpClient from microsoft.teamfoundationserver.client package doesn't work. As it doesn't work using RES API.
Here is how to reproduce it using the code:
We have a base branch here called branch and a repository entity called gitRepo
gitClient.CreatePushAsync(new GitPush
{
RefUpdates = new List<GitRefUpdate>
{
new GitRefUpdate
{
Name = "refs/heads/bump-submodule",
OldObjectId = branch.ObjectId
}
},
Commits = new List<GitCommitRef>
{
new GitCommitRef
{
Comment = "Bump submodule",
Changes = new List<GitChange>
{
new GitChange
{
ChangeType = VersionControlChangeType.Edit,
Item = external,
NewContent = new ItemContent { Content = newHash, ContentType = ItemContentType.RawText },
}
}
}
}
}, gitRepo.Id);
But, also, it doesn't work using the API:
POST: https://dev.azure.com/[param1]/[param2]/_apis/git/repositories/[param3]/pushes?api-version=7.1-preview.2
{
"refUpdates": [
{
"name": "refs/heads/bump-submodule-dev",
"oldObjectId": "[oldObjectId]"
}
],
"commits": [
{
"comment": "Update submodule.",
"changes": [
{
"changeType": "edit",
"item": {
"path": "/external/[submodule-name]"
},
"newContent": {
"content": "[new-hash]",
"contentType": "rawText"
}
}
]
}
]
}
What I get in a response is:
{
"$id": "1",
"innerException":
"message": "Expected a Blob, but objectId [hash] resolved to a Commit (path '/external/[submodule-name]')\r\nParameter name: newPush",
"typeName": "Microsoft.TeamFoundation.SourceControl.WebServer.InvalidArgumentValueException, Microsoft.TeamFoundation.SourceControl.WebServer",
"typeKey": "InvalidArgumentValueException",
"errorCode": 0,
"eventId": 0
}