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

Function runShow

packages/computer/src/git/cli.ts:849–874  ·  view source on GitHub ↗
(
  client: GitClient,
  args: string[],
  input: GitCliInput,
)

Source from the content-addressed store, hash-verified

847// ---------------------------------------------------------------
848
849async function runShow(
850 client: GitClient,
851 args: string[],
852 input: GitCliInput,
853): Promise<GitCliResult> {
854 const parsed = parseFlags(args, {});
855 if ("error" in parsed) {
856 return { stdout: "", stderr: `git show: ${parsed.error}\n`, exitCode: 129 };
857 }
858 const ref = parsed.positional[0] ?? "HEAD";
859 if (parsed.positional.length > 1) {
860 return {
861 stdout: "",
862 stderr: `git show: unexpected argument '${parsed.positional[1]}'\n`,
863 exitCode: 129,
864 };
865 }
866 const dir = resolveDir(undefined, input.cwd);
867 try {
868 const resolved = (await resolveRevisionRef(client, dir, ref)) ?? ref;
869 const c = await client.show({ dir, ref: resolved });
870 return { stdout: formatLogFull([c]), stderr: "", exitCode: 0 };
871 } catch (cause) {
872 return mapGitError("show", cause);
873 }
874}
875
876// ---------------------------------------------------------------
877// rev-parse

Callers 1

runGitCliFunction · 0.85

Calls 6

resolveDirFunction · 0.85
resolveRevisionRefFunction · 0.85
formatLogFullFunction · 0.85
mapGitErrorFunction · 0.85
showMethod · 0.80
parseFlagsFunction · 0.70

Tested by

no test coverage detected