mirror of
https://github.com/actions/checkout.git
synced 2026-05-22 03:21:35 +00:00
Fix checkout init for SHA-256 repositories
This commit is contained in:
@@ -318,6 +318,39 @@ describe('git-auth-helper tests', () => {
|
||||
)
|
||||
})
|
||||
|
||||
const configureSshCommand_doesNotPersistSshCommand =
|
||||
'configureSshCommand does not persist SSH command'
|
||||
it(configureSshCommand_doesNotPersistSshCommand, async () => {
|
||||
if (!sshPath) {
|
||||
process.stdout.write(
|
||||
`Skipped test "${configureSshCommand_doesNotPersistSshCommand}". Executable 'ssh' not found in the PATH.\n`
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
// Arrange
|
||||
await setup(configureSshCommand_doesNotPersistSshCommand)
|
||||
const authHelper = gitAuthHelper.createAuthHelper(git, settings)
|
||||
|
||||
// Act
|
||||
await authHelper.configureSshCommand()
|
||||
|
||||
// Assert git env var
|
||||
expect(git.setEnvironmentVariable).toHaveBeenCalledWith(
|
||||
'GIT_SSH_COMMAND',
|
||||
expect.any(String)
|
||||
)
|
||||
|
||||
// Assert the local SSH command was not persisted for the pre-init probe
|
||||
expect(git.config).not.toHaveBeenCalledWith(
|
||||
'core.sshCommand',
|
||||
expect.any(String)
|
||||
)
|
||||
|
||||
await authHelper.removeSshCommand()
|
||||
expect(git.env['GIT_SSH_COMMAND']).toBeUndefined()
|
||||
})
|
||||
|
||||
const configureAuth_writesExplicitKnownHosts = 'writes explicit known hosts'
|
||||
it(configureAuth_writesExplicitKnownHosts, async () => {
|
||||
if (!sshPath) {
|
||||
@@ -1103,6 +1136,7 @@ async function setup(testName: string): Promise<void> {
|
||||
),
|
||||
tryDisableAutomaticGarbageCollection: jest.fn(),
|
||||
tryGetFetchUrl: jest.fn(),
|
||||
tryGetObjectFormat: jest.fn(async () => ({format: '', succeeded: true})),
|
||||
tryGetConfigValues: jest.fn(
|
||||
async (
|
||||
key: string,
|
||||
|
||||
Reference in New Issue
Block a user