MCPcopy Index your code
hub / github.com/codeaashu/claude-code / reconcileSparseCheckout

Function reconcileSparseCheckout

src/utils/plugins/marketplaceManager.ts:1034–1061  ·  view source on GitHub ↗
(
  cwd: string,
  sparsePaths: string[] | undefined,
)

Source from the content-addressed store, hash-verified

1032 * trigger the clone path, which establishes the correct state from scratch.
1033 */
1034export async function reconcileSparseCheckout(
1035 cwd: string,
1036 sparsePaths: string[] | undefined,
1037): Promise<{ code: number; stderr: string }> {
1038 const env = { ...process.env, ...GIT_NO_PROMPT_ENV }
1039
1040 if (sparsePaths && sparsePaths.length > 0) {
1041 return execFileNoThrowWithCwd(
1042 gitExe(),
1043 ['sparse-checkout', 'set', '--cone', '--', ...sparsePaths],
1044 { cwd, timeout: getPluginGitTimeoutMs(), stdin: 'ignore', env },
1045 )
1046 }
1047
1048 const check = await execFileNoThrowWithCwd(
1049 gitExe(),
1050 ['config', '--get', 'core.sparseCheckout'],
1051 { cwd, stdin: 'ignore', env },
1052 )
1053 if (check.code === 0 && check.stdout.trim() === 'true') {
1054 return {
1055 code: 1,
1056 stderr:
1057 'sparsePaths removed from config but repository is sparse; re-cloning for full checkout',
1058 }
1059 }
1060 return { code: 0, stderr: '' }
1061}
1062
1063/**
1064 * Cache a marketplace from a git repository

Callers 1

cacheMarketplaceFromGitFunction · 0.85

Calls 2

execFileNoThrowWithCwdFunction · 0.85
getPluginGitTimeoutMsFunction · 0.85

Tested by

no test coverage detected