Add objectFormat setting to allow init()ing a repo with sha256

This commit is contained in:
Yang Zhao 2024-08-23 00:23:06 -07:00
parent 9a9194f871
commit 16bbbf6c3a
2 changed files with 12 additions and 3 deletions

View file

@ -42,7 +42,7 @@ export interface IGitCommandManager {
): Promise<void> ): Promise<void>
getDefaultBranch(repositoryUrl: string): Promise<string> getDefaultBranch(repositoryUrl: string): Promise<string>
getWorkingDirectory(): string getWorkingDirectory(): string
init(): Promise<void> init(options?: { objectFormat?: string }): Promise<void>
isDetached(): Promise<boolean> isDetached(): Promise<boolean>
lfsFetch(ref: string): Promise<void> lfsFetch(ref: string): Promise<void>
lfsInstall(): Promise<void> lfsInstall(): Promise<void>
@ -327,8 +327,12 @@ class GitCommandManager {
return this.workingDirectory return this.workingDirectory
} }
async init(): Promise<void> { async init(options?: { objectFormat?: string }): Promise<void> {
await this.execGit(['init', this.workingDirectory]) await this.execGit([
'init',
...(options?.objectFormat ? ["--object-format", options.objectFormat] : []),
this.workingDirectory
])
} }
async isDetached(): Promise<boolean> { async isDetached(): Promise<boolean> {

View file

@ -118,4 +118,9 @@ export interface IGitSourceSettings {
* User override on the GitHub Server/Host URL that hosts the repository to be cloned * User override on the GitHub Server/Host URL that hosts the repository to be cloned
*/ */
githubServerUrl: string | undefined githubServerUrl: string | undefined
/**
* Object format used for the repo, if it is not default
*/
objectFormat: string | undefined
} }