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 85f76c73cb
4 changed files with 20 additions and 7 deletions

10
dist/index.js vendored
View file

@ -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();
}