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

Function gitSubmoduleUpdate

src/utils/plugins/marketplaceManager.ts:609–644  ·  view source on GitHub ↗

* Sync submodule working dirs after a successful pull. gitClone() uses * --recurse-submodules, but gitPull() didn't — the parent repo's submodule * pointer would advance while the working dir stayed at the old commit, * making plugin sources in submodules unresolvable after marketplace update. *

(
  cwd: string,
  credentialArgs: string[],
  env: NodeJS.ProcessEnv,
  sparsePaths: string[] | undefined,
)

Source from the content-addressed store, hash-verified

607 * submodules are unaffected.
608 */
609async function gitSubmoduleUpdate(
610 cwd: string,
611 credentialArgs: string[],
612 env: NodeJS.ProcessEnv,
613 sparsePaths: string[] | undefined,
614): Promise<void> {
615 if (sparsePaths && sparsePaths.length > 0) return
616 const hasGitmodules = await getFsImplementation()
617 .stat(join(cwd, '.gitmodules'))
618 .then(
619 () => true,
620 () => false,
621 )
622 if (!hasGitmodules) return
623 const result = await execFileNoThrowWithCwd(
624 gitExe(),
625 [
626 '-c',
627 'core.sshCommand=ssh -o BatchMode=yes -o StrictHostKeyChecking=yes',
628 ...credentialArgs,
629 'submodule',
630 'update',
631 '--init',
632 '--recursive',
633 '--depth',
634 '1',
635 ],
636 { cwd, timeout: getPluginGitTimeoutMs(), stdin: 'ignore', env },
637 )
638 if (result.code !== 0) {
639 logForDebugging(
640 `git submodule update failed (non-fatal): ${result.stderr}`,
641 { level: 'warn' },
642 )
643 }
644}
645
646/**
647 * Enhance error messages for git pull failures

Callers 1

gitPullFunction · 0.85

Calls 4

getFsImplementationFunction · 0.85
execFileNoThrowWithCwdFunction · 0.85
getPluginGitTimeoutMsFunction · 0.85
logForDebuggingFunction · 0.85

Tested by

no test coverage detected