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

Function writeRefsAdResponse

src/wire/writeRefsAdResponse.js:4–22  ·  view source on GitHub ↗
({ capabilities, refs, symrefs })

Source from the content-addressed store, hash-verified

2import { pkg } from '../utils/pkg.js'
3
4export async function writeRefsAdResponse({ capabilities, refs, symrefs }) {
5 const stream = []
6 // Compose capabilities string
7 let syms = ''
8 for (const [key, value] of Object.entries(symrefs)) {
9 syms += `symref=${key}:${value} `
10 }
11 let caps = `\x00${[...capabilities].join(' ')} ${syms}agent=${pkg.agent}`
12 // stream.write(GitPktLine.encode(`# service=${service}\n`))
13 // stream.write(GitPktLine.flush())
14 // Note: In the edge case of a brand new repo, zero refs (and zero capabilities)
15 // are returned.
16 for (const [key, value] of Object.entries(refs)) {
17 stream.push(GitPktLine.encode(`${value} ${key}${caps}\n`))
18 caps = ''
19 }
20 stream.push(GitPktLine.flush())
21 return stream
22}

Callers 3

uploadPackFunction · 0.90
test-wire.jsFile · 0.85

Calls 3

encodeMethod · 0.80
flushMethod · 0.80
entriesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…