I wrote a HTML + Javascript add-on that uses Atlassian Connect v2 to retrieve files from and write them to my repository.
The addon consists of a fileview module which can edit the file you click on.
It links to the HTML page using the URL
/index.html?repo_uuid={repo_uuid}&file_cset={file_cset}&file_path={file_path}
it can retrieve the file using
var url = '/2.0/repositories/{}/' + repoUuid + '/src/' + cset + '/' + filePath;
but according to all examples when saving I need a 'Branch' :
var formData = new FormData();
formData.append(filePath, blob);
formData.append('message', 'Comments of commit');
formData.append('parents', cset);
formData.append('branch', "?");
url: '/2.0/repositories/{}/' + repoUuid + '/src/'
When filling in a hardcoded 'Master', the file is written to the Master, but obviously I'm not always editing a file on the Master branch.
How can I get the branch from the file I'm currently editing?
I have the cset, but that's not enough...
I tried adding these, but they remain undefined.
&revision={revision}&branch={branch}&branch_name={branch_name}&branch_resolved_hash={branch_resolved_hash}