( client: GitClient, args: string[], input: GitCliInput, )
| 994 | // --------------------------------------------------------------- |
| 995 | |
| 996 | async function runLsFiles( |
| 997 | client: GitClient, |
| 998 | args: string[], |
| 999 | input: GitCliInput, |
| 1000 | ): Promise<GitCliResult> { |
| 1001 | const parsed = parseFlags(args, { |
| 1002 | ref: { kind: "value" }, |
| 1003 | }); |
| 1004 | if ("error" in parsed) { |
| 1005 | return { stdout: "", stderr: `git ls-files: ${parsed.error}\n`, exitCode: 129 }; |
| 1006 | } |
| 1007 | if (parsed.positional.length > 0) { |
| 1008 | return { |
| 1009 | stdout: "", |
| 1010 | stderr: `git ls-files: unexpected argument '${parsed.positional[0]}'\n`, |
| 1011 | exitCode: 129, |
| 1012 | }; |
| 1013 | } |
| 1014 | const dir = resolveDir(undefined, input.cwd); |
| 1015 | try { |
| 1016 | const files = await client.lsFiles({ dir, ref: parsed.flags.ref as string | undefined }); |
| 1017 | return { stdout: files.length === 0 ? "" : `${files.join("\n")}\n`, stderr: "", exitCode: 0 }; |
| 1018 | } catch (cause) { |
| 1019 | return mapGitError("ls-files", cause); |
| 1020 | } |
| 1021 | } |
| 1022 | |
| 1023 | // --------------------------------------------------------------- |
| 1024 | // ls-tree |
no test coverage detected