MCPcopy
hub / github.com/leonhartX/gas-github / createBranch

Method createBranch

src/scm/gitlab.js:248–280  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

246 }
247
248 createBranch() {
249 const branch = $('#new-branch-name').val();
250 const payload = {
251 branch: branch,
252 ref: getBranch()
253 };
254 if (!branch || branch === '') return;
255 return new Promise((resolve, reject) => {
256 return $.ajax({
257 url: `${this.baseUrl}/projects/${getRepo().id}/repository/branches`,
258 headers: this.tokenHeader,
259 method: 'POST',
260 crossDomain: true,
261 dataType: 'json',
262 contentType: 'application/json',
263 data: JSON.stringify(payload)
264 })
265 .then(resolve)
266 .fail(reject);
267 })
268 .then(response => {
269 Object.assign(context.bindBranch, {
270 [getId()]: branch
271 });
272 chrome.storage.sync.set({
273 bindBranch: context.bindBranch
274 });
275 return branch;
276 })
277 .catch(err => {
278 throw new Error('Failed to create new branch.');
279 });
280 }
281
282 followPaginate(data) {
283 return new Promise((resolve, reject) => {

Callers

nothing calls this directly

Calls 3

getBranchFunction · 0.85
getRepoFunction · 0.85
getIdFunction · 0.85

Tested by

no test coverage detected