I'm struggling to understand how to implement the following API to update files in a repo:
GitLab and GitHub have a simple api - pass contents of a file + commit SHA, and it will update if the commit SHA is still current.
I tried this and of course it happily overwrites anything that was already there:
curl -X POST \
'https://api.bitbucket.org/2.0/repositories/%7B%7D/{uuid}/src' \
-H 'Authorization: Bearer ***' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'cache-control: no-cache' \
-d 'src%2Flocale%2Fen.js=test&message=Test%20commit'
How can I specify a file commit SHA so that it doesn't overwrite content if it's been updated? Thanks