使用Azure DevOps REST API更新Git存储库中的文件编码

时间:2020-11-06 07:11:53

标签: git azure-devops azure-devops-rest-api azure-repos

Azure DevOps REST API中有一个Pushes客户端,允许使用新的提交创建推送。我遵循了in here提供的示例,但是没有一个文件编码需要更改。我尝试在请求有效负载中提供必要的编码,如下所示:

  "refUpdates": [{ "name": "refs/heads/master", "oldObjectId": "..." }],
    "commits": [{
      "comment": "Comment",
      "changes": [{
        "changeType": 2, // also tried type "4" which stands for "Encoding"
        "item": {
          "path": "...",
          "contentMetadata": { "encoding": 1252 } // UTF-8
        },
        "newContent": { content: "New content", contentType: 0 },
      }]
    }]

但是它什么也没做,Pushes客户端似乎忽略了“ contentMetadata”字段。

是否可以使用Azure DevOps REST API更改文件编码?

1 个答案:

答案 0 :(得分:0)

我可以重现同样的问题。 contentMetadata字段被忽略,文件编码无法更新。

您可以在Developer Community website中将此问题报告给Microsoft开发团队。希望他们会调查此问题并提供解决方案。