| 95 | } |
| 96 | |
| 97 | commit(message: string, changeTree: { parentSha?: string; sha: string }) { |
| 98 | const commitParams: { |
| 99 | message: string; |
| 100 | tree: string; |
| 101 | parents: string[]; |
| 102 | author?: { name: string; date: string }; |
| 103 | } = { |
| 104 | message, |
| 105 | tree: changeTree.sha, |
| 106 | parents: changeTree.parentSha ? [changeTree.parentSha] : [], |
| 107 | }; |
| 108 | |
| 109 | if (this.commitAuthor) { |
| 110 | commitParams.author = { |
| 111 | ...this.commitAuthor, |
| 112 | date: new Date().toISOString(), |
| 113 | }; |
| 114 | } |
| 115 | |
| 116 | return this.request('/git/commits', { |
| 117 | method: 'POST', |
| 118 | body: JSON.stringify(commitParams), |
| 119 | }); |
| 120 | } |
| 121 | |
| 122 | nextUrlProcessor() { |
| 123 | return (url: string) => url.replace(/^(?:[a-z]+:\/\/.+?\/.+?\/.+?\/)/, `${this.apiRoot}/`); |