Description
- Please check our current Issues to see if someone already reported this https://github.com/Microsoft/vsts-node-api/issues
- Take a look at our Instructions for logging issues https://github.com/Microsoft/vsts-node-api/blob/master/CONTRIBUTING.md#instructions-for-logging-issues
Environment
Node version: 18.13
Npm version: 8.19.3
OS and version:
azure-devops-node-api version: ^12.1.0
Issue Description
I am trying to get the raw diff text of a given commit. If it were GitHub, you would do this by sending a GET request to commits/sha with the header application/vnd.github.diff
. Azure DevOps doesn't seem to have a similar concept.
The closest thing I can find are the below methods:
- getFileDiffs
- getChanges
getFileDiffs
gives some relative information with line counts, but not enough info to come up with an actual diff.
getChanges
returns GitCommitDiffs
which is ultimately a wrapper around GitChange[]
. In the documentation, it states that GitChange
has some interesting properties that appear to do what I need. But, they are never defined. Is there some header or different method I need to call in order to get a git diff given a commit and/or file path?
newContent | ItemContent | Content of the item after the change.
newContent
ItemContent
Content of the item after the change.
Expected behaviour
There should be a way to obtain raw diff text from the api. I am trying to create automated release notes but I need the raw diff text in order to do so.
Actual behaviour
There are methods that lead you to believe you can come up with enough information to figure out exact differences and compile the diff text on your own, but they all ultimately lead to a dead end.
There are few hacks/workaround posted out there but none seem to work: