MCPcopy Create free account
hub / github.com/isomorphic-git/isomorphic-git / parseListRefsResponse

Function parseListRefsResponse

src/wire/parseListRefsResponse.js:11–38  ·  view source on GitHub ↗
(stream)

Source from the content-addressed store, hash-verified

9 */
10
11export async function parseListRefsResponse(stream) {
12 const read = GitPktLine.streamReader(stream)
13
14 // TODO: when we re-write everything to minimize memory usage,
15 // we could make this a generator
16 const refs = []
17
18 let line
19 while (true) {
20 line = await read()
21 if (line === true) break
22 if (line === null) continue
23 line = line.toString('utf8').replace(/\n$/, '')
24 const [oid, ref, ...attrs] = line.split(' ')
25 const r = { ref, oid }
26 for (const attr of attrs) {
27 const [name, value] = attr.split(':')
28 if (name === 'symref-target') {
29 r.target = value
30 } else if (name === 'peeled') {
31 r.peeled = value
32 }
33 }
34 refs.push(r)
35 }
36
37 return refs
38}

Callers 1

listServerRefsFunction · 0.90

Calls 2

streamReaderMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…