({
http,
onAuth,
onAuthSuccess,
onAuthFailure,
corsProxy,
url,
headers = {},
forPush = false,
protocolVersion = 2,
prefix,
symrefs,
peelTags,
})
| 103 | * |
| 104 | */ |
| 105 | export async function listServerRefs({ |
| 106 | http, |
| 107 | onAuth, |
| 108 | onAuthSuccess, |
| 109 | onAuthFailure, |
| 110 | corsProxy, |
| 111 | url, |
| 112 | headers = {}, |
| 113 | forPush = false, |
| 114 | protocolVersion = 2, |
| 115 | prefix, |
| 116 | symrefs, |
| 117 | peelTags, |
| 118 | }) { |
| 119 | try { |
| 120 | assertParameter('http', http) |
| 121 | assertParameter('url', url) |
| 122 | |
| 123 | const remote = await GitRemoteHTTP.discover({ |
| 124 | http, |
| 125 | onAuth, |
| 126 | onAuthSuccess, |
| 127 | onAuthFailure, |
| 128 | corsProxy, |
| 129 | service: forPush ? 'git-receive-pack' : 'git-upload-pack', |
| 130 | url, |
| 131 | headers, |
| 132 | protocolVersion, |
| 133 | }) |
| 134 | |
| 135 | if (remote.protocolVersion === 1) { |
| 136 | return formatInfoRefs(remote, prefix, symrefs, peelTags) |
| 137 | } |
| 138 | |
| 139 | // Protocol Version 2 |
| 140 | const body = await writeListRefsRequest({ prefix, symrefs, peelTags }) |
| 141 | |
| 142 | const res = await GitRemoteHTTP.connect({ |
| 143 | http, |
| 144 | auth: remote.auth, |
| 145 | headers, |
| 146 | corsProxy, |
| 147 | service: forPush ? 'git-receive-pack' : 'git-upload-pack', |
| 148 | url, |
| 149 | body, |
| 150 | }) |
| 151 | |
| 152 | return parseListRefsResponse(res.body) |
| 153 | } catch (err) { |
| 154 | err.caller = 'git.listServerRefs' |
| 155 | throw err |
| 156 | } |
| 157 | } |
no test coverage detected
searching dependent graphs…