1
0
Fork 0
mirror of https://github.com/actions/checkout.git synced 2025-07-13 20:50:45 +00:00

Take global core.sshCommand into consideration

This commit is contained in:
Luca Niccoli 2023-01-04 17:08:43 +01:00
parent ac59398561
commit e978c3f43b
5 changed files with 103 additions and 11 deletions

View file

@ -26,6 +26,7 @@ export interface IGitCommandManager {
): Promise<void>
configExists(configKey: string, globalConfig?: boolean): Promise<boolean>
fetch(refSpec: string[], fetchDepth?: number): Promise<void>
configGet(configKey: string, globalConfig?: boolean): Promise<string>
getDefaultBranch(repositoryUrl: string): Promise<string>
getWorkingDirectory(): string
init(): Promise<void>
@ -201,6 +202,15 @@ class GitCommandManager {
return output.exitCode === 0
}
async configGet(configKey: string, globalConfig?: boolean): Promise<string> {
const output = await this.execGit([
'config',
globalConfig ? '--global' : '--local',
configKey
])
return output.stdout.trim()
}
async fetch(refSpec: string[], fetchDepth?: number): Promise<void> {
const args = ['-c', 'protocol.version=2', 'fetch']
if (!refSpec.some(x => x === refHelper.tagsRefSpec)) {