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

Function rmWith

packages/computer/src/git/staging.ts:166–179  ·  view source on GitHub ↗
(opts: RmWithDeps)

Source from the content-addressed store, hash-verified

164}
165
166export async function rmWith(opts: RmWithDeps): Promise<void> {
167 const dir = opts.dir ?? "/";
168 for (const filepath of opts.paths) {
169 try {
170 await opts.git.remove({ fs: opts.fs, dir, filepath, cache: opts.cache });
171 } catch (cause) {
172 if (isNotARepositoryCause(cause)) throw new NotARepositoryError(dir, { cause });
173 if (looksLikePathspecMiss(cause)) {
174 throw new PathspecNotFoundError(filepath, { cause });
175 }
176 throw new GitError("ERMFAIL", `git rm failed: ${errorMessage(cause)}`, { cause });
177 }
178 }
179}
180
181function looksLikePathspecMiss(cause: unknown): boolean {
182 if (!(cause instanceof Error)) return false;

Callers 2

rmFunction · 0.85
staging.test.tsFile · 0.85

Calls 4

isNotARepositoryCauseFunction · 0.85
looksLikePathspecMissFunction · 0.85
errorMessageFunction · 0.70
removeMethod · 0.65

Tested by

no test coverage detected