|
134 | 134 |
|
135 | 135 | function updateTree(branch, cb) { |
136 | 136 | if (branch === currentTree.branch && currentTree.sha) return cb(null, currentTree.sha); |
137 | | - that.getRef(branch, function(err, sha) { |
| 137 | + that.getRef("heads/"+branch, function(err, sha) { |
138 | 138 | currentTree.branch = branch; |
139 | 139 | currentTree.sha = sha; |
140 | 140 | cb(err, sha); |
|
145 | 145 | // ------- |
146 | 146 |
|
147 | 147 | this.getRef = function(ref, cb) { |
148 | | - _request("GET", repoPath + "/git/refs/heads/" + ref, null, function(err, res) { |
| 148 | + _request("GET", repoPath + "/git/refs/" + ref, null, function(err, res) { |
149 | 149 | if (err) return cb(err); |
150 | 150 | cb(null, res.object.sha); |
151 | 151 | }); |
|
195 | 195 |
|
196 | 196 | this.getSha = function(branch, path, cb) { |
197 | 197 | // Just use head if path is empty |
198 | | - if (path === "") return that.getRef(branch, cb); |
| 198 | + if (path === "") return that.getRef("heads/"+branch, cb); |
199 | 199 | that.getTree(branch+"?recursive=true", function(err, tree) { |
200 | 200 | var file = _.select(tree, function(file) { |
201 | 201 | return file.path === path; |
|
313 | 313 | // ------- |
314 | 314 |
|
315 | 315 | this.fork = function(cb) { |
316 | | - _request("POST", repoPath + "/forks", null, function(err, forkedRepo) { |
317 | | - cb(null, forkedRepo); |
318 | | - }); |
| 316 | + _request("POST", repoPath + "/forks", null, cb); |
319 | 317 | }; |
320 | 318 |
|
321 | 319 | // Create pull request |
|
0 commit comments