* Parse output from `git show-ref` * * @api private * @return {Array }
(refs)
| 319 | */ |
| 320 | |
| 321 | function parseShowRefOutput (refs) { |
| 322 | // TODO handle tags |
| 323 | return (refs || '').split(EOL_REGEX).filter(function (str) { |
| 324 | return !!str; |
| 325 | }).map(function (ref) { |
| 326 | var parts = ref.split(' '); |
| 327 | var hash = parts[0]; |
| 328 | var refSpec = parts[1].split('/'); |
| 329 | var branch = refSpec[refSpec.length - 1]; |
| 330 | var isRemote = /^refs\/remotes\//.test(parts[1]); |
| 331 | var remote = isRemote ? |
| 332 | /^refs\/remotes\/([a-zA-Z0.9_-]+)\//.exec(parts[1]) : |
| 333 | void 0; |
| 334 | |
| 335 | return { |
| 336 | ref: branch, |
| 337 | remote: remote, |
| 338 | hash: hash |
| 339 | }; |
| 340 | }); |
| 341 | } |
| 342 | |
| 343 | /** |
| 344 | * get hash for a given ref. If ref is a branch name, get the hash for the |
no outgoing calls
no test coverage detected
searching dependent graphs…