* 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, )
| 607 | * submodules are unaffected. |
| 608 | */ |
| 609 | async 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 |
no test coverage detected