-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GitChanges -> newContent undefined / Impossible to Get Raw git diff text #571
Comments
This issue has had no activity in 90 days. Please comment if it is not actually stale |
not stale |
This issue has had no activity in 90 days. Please comment if it is not actually stale |
FileDiff function gives absolutely non relatable output, I have tried all possible ways to find a solution. Nothing works. Any possible solutions please need some pointers. Thank you. |
Indeed |
https://learn.microsoft.com/en-us/rest/api/azure/devops/git/diffs/get?view=azure-devops-rest-7.0&tabs=HTTP#gitchange |
The rest API is still not populating the newContent, do we have a fix date for this yet? |
Hi, I was able to find a solution for this, a workaround. So I wrote a shell script to run on an agent to get the diff text by:
The full command is like this: CURRENT_REPO_ACCESS_GIT_URL = The current project repository access git URL, usually it contains read/write access token, something like this: https://${PAT}@dev.azure.com/organization/project/_git/repo |
Why? GitHub Api does it. It looks like your script ultimately downloads a repo and compares two branches manually. There's no reason why the Azure Api can't do this. A few endpoint suggest that it's possible but just doesn't seem to work. |
@marc-wilson Yeah I know Github does that, also BitBucket API as well, my case is different, I have a SaaS that should work with git services, everything in place but Azure DevOps, I have this workaround for it only. The others are just fine |
Any update on this issue ? Still not able to get raw git diff from Azure DevOps REST API |
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
gives some relative information with line counts, but not enough info to come up with an actual diff.getChanges
returnsGitCommitDiffs
which is ultimately a wrapper aroundGitChange[]
. In the documentation, it states thatGitChange
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?GitChange
https://learn.microsoft.com/en-us/rest/api/azure/devops/git/diffs/get?view=azure-devops-rest-7.2&tabs=HTTP#gitchange
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:
The text was updated successfully, but these errors were encountered: