async function listServerRefs({
  http,
  onAuth,
  onAuthSuccess,
  onAuthFailure,
  corsProxy,
  url,
  headers = {},
  forPush = false,
  protocolVersion = 2,
  prefix,
  symrefs,
  peelTags,
}) {
  try {
    assertParameter('http', http)
    assertParameter('url', url)

    const remote = await GitRemoteHTTP.discover({
      http,
      onAuth,
      onAuthSuccess,
      onAuthFailure,
      corsProxy,
      service: forPush ? 'git-receive-pack' : 'git-upload-pack',
      url,
      headers,
      protocolVersion,
    })

    if (remote.protocolVersion === 1) {
      return formatInfoRefs(remote, prefix, symrefs, peelTags)
    }

    // Protocol Version 2
    const body = await writeListRefsRequest({ prefix, symrefs, peelTags })

    const res = await GitRemoteHTTP.connect({
      http,
      auth: remote.auth,
      headers,
      corsProxy,
      service: forPush ? 'git-receive-pack' : 'git-upload-pack',
      url,
      body,
    })

    return parseListRefsResponse(res.body)
  } catch (err) {
    err.caller = 'git.listServerRefs'
    throw err
  }
}
Fetch a list of refs (branches, tags, etc) from a server.

This is a rare command that doesn't require an `fs`, `dir`, or even `gitdir` argument.
It just requires an `http` argument.

### About `protocolVersion`

There's a rather fun trade-off between Git Protocol Version 1 and Git Protocol Version 2.
Version 2 actually requires 2 HTTP requests instead of 1, making it similar to fetch or push in that regard.
However, version 2 supports server-side filtering by prefix, whereas that filtering is done client-side in version 1.
Which protocol is most efficient therefore depends on the number of refs on the remote, the latency of the server, and speed of the network connection.
For an small repos (or fast Internet connections), the requirement to make two trips to the server makes protocol 2 slower.
But for large repos (or slow Internet connections), the decreased payload size of the second request makes up for the additional request.

Hard numbers vary by situation, but here's some numbers from my machine:

Using isomorphic-git in a browser, with a CORS proxy, listing only the branches (refs/heads) of https://github.com/isomorphic-git/isomorphic-git
- Protocol Version 1 took ~300ms and transferred 84 KB.
- Protocol Version 2 took ~500ms and transferred 4.1 KB.

Using isomorphic-git in a browser, with a CORS proxy, listing only the branches (refs/heads) of https://gitlab.com/gitlab-org/gitlab
- Protocol Version 1 took ~4900ms and transferred 9.41 MB.
- Protocol Version 2 took ~1280ms and transferred 433 KB.

Finally, there is a fun quirk regarding the `symrefs` parameter.
Protocol Version 1 will generally only return the `HEAD` symref and not others.
Historically, this meant that servers don't use symbolic refs except for `HEAD`, which is used to point at the "default branch".
However Protocol Version 2 can return *all* the symbolic refs on the server.
So if you are running your own git server, you could take advantage of that I guess.

#### TL;DR
If you are _not_ taking advantage of `prefix` I would recommend `protocolVersion: 1`.
Otherwise, I recommend to use the default which is `protocolVersion: 2`.

@param {object} args
@param {HttpClient} args.http - an HTTP client
@param {AuthCallback} [args.onAuth] - optional auth fill callback
@param {AuthFailureCallback} [args.onAuthFailure] - optional auth rejected callback
@param {AuthSuccessCallback} [args.onAuthSuccess] - optional auth approved callback
@param {string} args.url - The URL of the remote repository. Will be gotten from gitconfig if absent.
@param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.
@param {boolean} [args.forPush = false] - By default, the command queries the 'fetch' capabilities. If true, it will ask for the 'push' capabilities.
@param {Object<string, string>} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config
@param {1 | 2} [args.protocolVersion = 2] - Which version of the Git Protocol to use.
@param {string} [args.prefix] - Only list refs that start with this prefix
@param {boolean} [args.symrefs = false] - Include symbolic ref targets
@param {boolean} [args.peelTags = false] - Include annotated tag peeled targets

@returns {Promise<ServerRef[]>} Resolves successfully with an array of ServerRef objects
@see ServerRef

@example
// List all the branches on a repo
let refs = await git.listServerRefs({
  http,
  corsProxy: "https://cors.isomorphic-git.org",
  url: "https://github.com/isomorphic-git/isomorphic-git.git",
  prefix: "refs/heads/",
});
console.log(refs);

@example
// Get the default branch on a repo
let refs = await git.listServerRefs({
  http,
  corsProxy: "https://cors.isomorphic-git.org",
  url: "https://github.com/isomorphic-git/isomorphic-git.git",
  prefix: "HEAD",
  symrefs: true,
});
console.log(refs);

@example
// List all the tags on a repo
let refs = await git.listServerRefs({
  http,
  corsProxy: "https://cors.isomorphic-git.org",
  url: "https://github.com/isomorphic-git/isomorphic-git.git",
  prefix: "refs/tags/",
  peelTags: true,
});
console.log(refs);

@example
// List all the pull requests on a repo
let refs = await git.listServerRefs({
  http,
  corsProxy: "https://cors.isomorphic-git.org",
  url: "https://github.com/isomorphic-git/isomorphic-git.git",
  prefix: "refs/pull/",
});
console.log(refs);