3
0
Fork 0
mirror of https://code.forgejo.org/actions/checkout.git synced 2026-03-07 17:14:54 +00:00

more unit tests and corresponding refactoring

This commit is contained in:
eric sciple 2020-02-15 01:43:52 -05:00
parent f858c22e96
commit 7cd17f8a83
14 changed files with 1049 additions and 305 deletions

View file

@ -26,6 +26,7 @@ export interface IGitCommandManager {
lfsInstall(): Promise<void>
log1(): Promise<void>
remoteAdd(remoteName: string, remoteUrl: string): Promise<void>
setEnvironmentVariable(name: string, value: string): void
tagExists(pattern: string): Promise<boolean>
tryClean(): Promise<boolean>
tryConfigUnset(configKey: string): Promise<boolean>
@ -34,7 +35,7 @@ export interface IGitCommandManager {
tryReset(): Promise<boolean>
}
export async function CreateCommandManager(
export async function createCommandManager(
workingDirectory: string,
lfs: boolean
): Promise<IGitCommandManager> {
@ -207,6 +208,10 @@ class GitCommandManager {
await this.execGit(['remote', 'add', remoteName, remoteUrl])
}
setEnvironmentVariable(name: string, value: string): void {
this.gitEnv[name] = value
}
async tagExists(pattern: string): Promise<boolean> {
const output = await this.execGit(['tag', '--list', pattern])
return !!output.stdout.trim()