MCPcopy Create free account
hub / github.com/play-co/devkit / parseShowRefOutput

Function parseShowRefOutput

src/util/gitClient/functions.js:321–341  ·  view source on GitHub ↗

* Parse output from `git show-ref` * * @api private * @return {Array }

(refs)

Source from the content-addressed store, hash-verified

319 */
320
321function 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

Callers 1

functions.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…