Fix checkout init for SHA-256 repositories

This commit is contained in:
Yashwanth Anantharaju
2026-05-21 14:31:18 -04:00
parent 900f2210b1
commit daa5732ee1
7 changed files with 445 additions and 27 deletions

View File

@@ -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,