mirror of
https://code.forgejo.org/actions/checkout.git
synced 2025-04-24 12:25:34 +00:00
Merge 65f77605c0
into 85e6279cec
This commit is contained in:
commit
8c2f86ce2e
10 changed files with 71 additions and 1 deletions
20
dist/index.js
vendored
20
dist/index.js
vendored
|
@ -748,6 +748,13 @@ class GitCommandManager {
|
|||
yield this.execGit(['remote', 'add', remoteName, remoteUrl]);
|
||||
});
|
||||
}
|
||||
referenceAdd(alternateObjects) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const alternatePath = path.join(this.workingDirectory, '.git/objects/info/alternates');
|
||||
core.info(`Adding a git alternate to reference repo at ${alternateObjects}`);
|
||||
yield fs.promises.writeFile(alternatePath, `${alternateObjects}\n`);
|
||||
});
|
||||
}
|
||||
removeEnvironmentVariable(name) {
|
||||
delete this.gitEnv[name];
|
||||
}
|
||||
|
@ -1239,6 +1246,17 @@ function getSource(settings) {
|
|||
yield git.init();
|
||||
yield git.remoteAdd('origin', repositoryUrl);
|
||||
core.endGroup();
|
||||
if (settings.reference !== undefined) {
|
||||
const alternateObjects = path.join(settings.reference, '/objects');
|
||||
if (fsHelper.directoryExistsSync(alternateObjects, false)) {
|
||||
core.startGroup('Adding a reference repository');
|
||||
yield git.referenceAdd(alternateObjects);
|
||||
core.endGroup();
|
||||
}
|
||||
else {
|
||||
core.warning(`Reference repository was specified, but directory ${alternateObjects} does not exists`);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Disable automatic garbage collection
|
||||
core.startGroup('Disabling automatic garbage collection');
|
||||
|
@ -1831,6 +1849,8 @@ function getInputs() {
|
|||
// Determine the GitHub URL that the repository is being hosted from
|
||||
result.githubServerUrl = core.getInput('github-server-url');
|
||||
core.debug(`GitHub Host URL = ${result.githubServerUrl}`);
|
||||
result.reference = core.getInput('reference');
|
||||
core.debug(`Reference repository = ${result.reference}`);
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue