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

Function readConfigString

packages/computer/src/git/commit.ts:142–156  ·  view source on GitHub ↗
(
  opts: CommitWithDeps,
  dir: string,
  path: string,
)

Source from the content-addressed store, hash-verified

140}
141
142async function readConfigString(
143 opts: CommitWithDeps,
144 dir: string,
145 path: string,
146): Promise<string | undefined> {
147 try {
148 const value = await opts.git.getConfig({ fs: opts.fs, dir, path });
149 return typeof value === "string" && value.length > 0 ? value : undefined;
150 } catch {
151 // A missing config file or unreadable key is not an error
152 // here; identity resolution just falls through to the next
153 // source.
154 return undefined;
155 }
156}
157
158function errorMessage(cause: unknown): string {
159 if (cause instanceof Error) return cause.message;

Callers 1

commitWithFunction · 0.85

Calls 1

getConfigMethod · 0.65

Tested by

no test coverage detected