diff --git a/dist/index.js b/dist/index.js index 9d959a9..a002ab1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -711,9 +711,13 @@ class GitCommandManager { getWorkingDirectory() { return this.workingDirectory; } - init() { + init(options) { return __awaiter(this, void 0, void 0, function* () { - yield this.execGit(['init', this.workingDirectory]); + yield this.execGit([ + 'init', + ...((options === null || options === void 0 ? void 0 : options.objectFormat) ? [`--object-format=${options.objectFormat}`] : []), + this.workingDirectory + ]); }); } isDetached() { @@ -1238,7 +1242,7 @@ function getSource(settings) { // Initialize the repository if (!fsHelper.directoryExistsSync(path.join(settings.repositoryPath, '.git'))) { core.startGroup('Initializing the repository'); - yield git.init(); + yield git.init({ objectFormat: settings.objectFormat }); yield git.remoteAdd('origin', repositoryUrl); core.endGroup(); } diff --git a/src/git-command-manager.ts b/src/git-command-manager.ts index 8e42a38..f19952e 100644 --- a/src/git-command-manager.ts +++ b/src/git-command-manager.ts @@ -42,7 +42,7 @@ export interface IGitCommandManager { ): Promise getDefaultBranch(repositoryUrl: string): Promise getWorkingDirectory(): string - init(): Promise + init(options?: { objectFormat?: string }): Promise isDetached(): Promise lfsFetch(ref: string): Promise lfsInstall(): Promise @@ -327,8 +327,12 @@ class GitCommandManager { return this.workingDirectory } - async init(): Promise { - await this.execGit(['init', this.workingDirectory]) + async init(options?: { objectFormat?: string }): Promise { + await this.execGit([ + 'init', + ...(options?.objectFormat ? [`--object-format=${options.objectFormat}`] : []), + this.workingDirectory + ]) } async isDetached(): Promise { diff --git a/src/git-source-provider.ts b/src/git-source-provider.ts index f723d94..639aeb6 100644 --- a/src/git-source-provider.ts +++ b/src/git-source-provider.ts @@ -110,7 +110,7 @@ export async function getSource(settings: IGitSourceSettings): Promise { !fsHelper.directoryExistsSync(path.join(settings.repositoryPath, '.git')) ) { core.startGroup('Initializing the repository') - await git.init() + await git.init({ objectFormat: settings.objectFormat }) await git.remoteAdd('origin', repositoryUrl) core.endGroup() } diff --git a/src/git-source-settings.ts b/src/git-source-settings.ts index 4e41ac3..f26e83f 100644 --- a/src/git-source-settings.ts +++ b/src/git-source-settings.ts @@ -118,4 +118,9 @@ export interface IGitSourceSettings { * User override on the GitHub Server/Host URL that hosts the repository to be cloned */ githubServerUrl: string | undefined + + /** + * Object format used for the repo, if it is not default + */ + objectFormat: string | undefined }