This commit is contained in:
Nacho Orlandoni 2025-06-09 16:25:07 -06:00 committed by GitHub
commit 2e696d95b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 71 additions and 1 deletions

View file

@ -48,6 +48,7 @@ export interface IGitCommandManager {
lfsInstall(): Promise<void>
log1(format?: string): Promise<string>
remoteAdd(remoteName: string, remoteUrl: string): Promise<void>
referenceAdd(reference: string): Promise<void>
removeEnvironmentVariable(name: string): void
revParse(ref: string): Promise<string>
setEnvironmentVariable(name: string, value: string): void
@ -364,6 +365,15 @@ class GitCommandManager {
await this.execGit(['remote', 'add', remoteName, remoteUrl])
}
async referenceAdd(alternateObjects: string): Promise<void> {
const alternatePath = path.join(
this.workingDirectory,
'.git/objects/info/alternates'
)
core.info(`Adding a git alternate to reference repo at ${alternateObjects}`)
await fs.promises.writeFile(alternatePath, `${alternateObjects}\n`)
}
removeEnvironmentVariable(name: string): void {
delete this.gitEnv[name]
}