(
fakeGitPath: string,
options: { failIfSshAskpassIsSet: boolean }
)
| 718 | } |
| 719 | |
| 720 | async function writeFakeGitCloneEnvLoggingShim( |
| 721 | fakeGitPath: string, |
| 722 | options: { failIfSshAskpassIsSet: boolean } |
| 723 | ): Promise<void> { |
| 724 | const sshAskpassGuard = options.failIfSshAskpassIsSet |
| 725 | ? ` |
| 726 | if [ -n "$SSH_ASKPASS" ]; then |
| 727 | echo "Unexpected SSH_ASKPASS for non-SSH clone" >&2 |
| 728 | exit 128 |
| 729 | fi` |
| 730 | : ""; |
| 731 | |
| 732 | await fs.writeFile( |
| 733 | fakeGitPath, |
| 734 | `#!/bin/sh |
| 735 | if [ "$1" = "clone" ]; then |
| 736 | printf 'SSH_ASKPASS=%s\nSSH_ASKPASS_REQUIRE=%s\nGIT_TERMINAL_PROMPT=%s\n' "\${SSH_ASKPASS:-}" "\${SSH_ASKPASS_REQUIRE:-}" "\${GIT_TERMINAL_PROMPT:-}" > "$FAKE_GIT_ENV_LOG"${sshAskpassGuard} |
| 737 | mkdir -p "$5/.git" |
| 738 | exit 0 |
| 739 | fi |
| 740 | exit 1 |
| 741 | `, |
| 742 | "utf-8" |
| 743 | ); |
| 744 | await fs.chmod(fakeGitPath, 0o755); |
| 745 | } |
| 746 | |
| 747 | async function cloneAndCaptureAskpassEnv(options: { |
| 748 | testCaseId: string; |
no test coverage detected