MCPcopy Create free account
hub / github.com/cloudflare/computer / resolveRevisionRef

Function resolveRevisionRef

packages/computer/src/git/cli.ts:2354–2361  ·  view source on GitHub ↗

* Resolve a ref that may carry a revision suffix (`HEAD^`, * `HEAD~2`, ...) to a concrete oid via `rev-parse`, which owns * the suffix-walking logic. A plain ref is returned untouched so * the downstream method keeps resolving branch / tag names * itself. Used by subcommands whose typed methods

(
  client: GitClient,
  dir: string,
  ref: string | undefined,
)

Source from the content-addressed store, hash-verified

2352 * grammar.
2353 */
2354async function resolveRevisionRef(
2355 client: GitClient,
2356 dir: string,
2357 ref: string | undefined,
2358): Promise<string | undefined> {
2359 if (ref === undefined || !hasRevisionSuffix(ref)) return ref;
2360 return client.revParse({ dir, ref });
2361}
2362
2363function isSupportedRemoteUrl(url: string): boolean {
2364 return url.startsWith("https://") || url.startsWith("http://") || url.startsWith("file://");

Callers 4

runDiffFunction · 0.85
runLogFunction · 0.85
runShowFunction · 0.85
runResetFunction · 0.85

Calls 2

hasRevisionSuffixFunction · 0.85
revParseMethod · 0.80

Tested by

no test coverage detected