(client: GitClient, args: string[], input: GitCliInput)
| 577 | // --------------------------------------------------------------- |
| 578 | |
| 579 | async function runRm(client: GitClient, args: string[], input: GitCliInput): Promise<GitCliResult> { |
| 580 | // `git rm <pathspec>...`. We don't surface --cached (yet); the |
| 581 | // typed surface lacks it and isomorphic-git's `remove` only |
| 582 | // unstages — it does not touch the working tree. Document this |
| 583 | // in the docs phase; warn here so a caller piping in --cached |
| 584 | // isn't surprised. |
| 585 | const parsed = parseFlags(args, { |
| 586 | cached: { kind: "bool" }, |
| 587 | }); |
| 588 | if ("error" in parsed) { |
| 589 | return { stdout: "", stderr: `git rm: ${parsed.error}\n`, exitCode: 129 }; |
| 590 | } |
| 591 | if (parsed.positional.length === 0) { |
| 592 | return { |
| 593 | stdout: "", |
| 594 | stderr: "git rm: no pathspec given on command line\n", |
| 595 | exitCode: 129, |
| 596 | }; |
| 597 | } |
| 598 | const dir = resolveDir(undefined, input.cwd); |
| 599 | try { |
| 600 | await client.rm({ dir, paths: parsed.positional }); |
| 601 | } catch (cause) { |
| 602 | return mapGitError("rm", cause); |
| 603 | } |
| 604 | return { stdout: "", stderr: "", exitCode: 0 }; |
| 605 | } |
| 606 | |
| 607 | // --------------------------------------------------------------- |
| 608 | // commit |
no test coverage detected