|
|
@ -7533,13 +7533,16 @@ class GitCommandManager {
|
|
|
|
return output.exitCode === 0;
|
|
|
|
return output.exitCode === 0;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fetch(refSpec, fetchDepth) {
|
|
|
|
fetch(refSpec, fetchDepth, showProgress) {
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
const args = ['-c', 'protocol.version=2', 'fetch'];
|
|
|
|
const args = ['-c', 'protocol.version=2', 'fetch'];
|
|
|
|
if (!refSpec.some(x => x === refHelper.tagsRefSpec)) {
|
|
|
|
if (!refSpec.some(x => x === refHelper.tagsRefSpec)) {
|
|
|
|
args.push('--no-tags');
|
|
|
|
args.push('--no-tags');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
args.push('--prune', '--progress', '--no-recurse-submodules');
|
|
|
|
args.push('--prune', '--no-recurse-submodules');
|
|
|
|
|
|
|
|
if (showProgress) {
|
|
|
|
|
|
|
|
args.push('--progress');
|
|
|
|
|
|
|
|
}
|
|
|
|
if (fetchDepth && fetchDepth > 0) {
|
|
|
|
if (fetchDepth && fetchDepth > 0) {
|
|
|
|
args.push(`--depth=${fetchDepth}`);
|
|
|
|
args.push(`--depth=${fetchDepth}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -18521,6 +18524,10 @@ function getInputs() {
|
|
|
|
result.fetchDepth = 0;
|
|
|
|
result.fetchDepth = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
core.debug(`fetch depth = ${result.fetchDepth}`);
|
|
|
|
core.debug(`fetch depth = ${result.fetchDepth}`);
|
|
|
|
|
|
|
|
// Show fetch progress
|
|
|
|
|
|
|
|
result.showProgress =
|
|
|
|
|
|
|
|
(core.getInput('show-progress') || 'true').toUpperCase() === 'TRUE';
|
|
|
|
|
|
|
|
core.debug(`show progress = ${result.showProgress}`);
|
|
|
|
// LFS
|
|
|
|
// LFS
|
|
|
|
result.lfs = (core.getInput('lfs') || 'false').toUpperCase() === 'TRUE';
|
|
|
|
result.lfs = (core.getInput('lfs') || 'false').toUpperCase() === 'TRUE';
|
|
|
|
core.debug(`lfs = ${result.lfs}`);
|
|
|
|
core.debug(`lfs = ${result.lfs}`);
|
|
|
@ -31971,17 +31978,17 @@ function getSource(settings) {
|
|
|
|
if (settings.fetchDepth <= 0) {
|
|
|
|
if (settings.fetchDepth <= 0) {
|
|
|
|
// Fetch all branches and tags
|
|
|
|
// Fetch all branches and tags
|
|
|
|
let refSpec = refHelper.getRefSpecForAllHistory(settings.ref, settings.commit);
|
|
|
|
let refSpec = refHelper.getRefSpecForAllHistory(settings.ref, settings.commit);
|
|
|
|
yield git.fetch(refSpec);
|
|
|
|
yield git.fetch(refSpec, settings.fetchDepth, settings.showProgress);
|
|
|
|
// When all history is fetched, the ref we're interested in may have moved to a different
|
|
|
|
// When all history is fetched, the ref we're interested in may have moved to a different
|
|
|
|
// commit (push or force push). If so, fetch again with a targeted refspec.
|
|
|
|
// commit (push or force push). If so, fetch again with a targeted refspec.
|
|
|
|
if (!(yield refHelper.testRef(git, settings.ref, settings.commit))) {
|
|
|
|
if (!(yield refHelper.testRef(git, settings.ref, settings.commit))) {
|
|
|
|
refSpec = refHelper.getRefSpec(settings.ref, settings.commit);
|
|
|
|
refSpec = refHelper.getRefSpec(settings.ref, settings.commit);
|
|
|
|
yield git.fetch(refSpec);
|
|
|
|
yield git.fetch(refSpec, settings.fetchDepth, settings.showProgress);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
const refSpec = refHelper.getRefSpec(settings.ref, settings.commit);
|
|
|
|
const refSpec = refHelper.getRefSpec(settings.ref, settings.commit);
|
|
|
|
yield git.fetch(refSpec, settings.fetchDepth);
|
|
|
|
yield git.fetch(refSpec, settings.fetchDepth, settings.showProgress);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
core.endGroup();
|
|
|
|
core.endGroup();
|
|
|
|
// Checkout info
|
|
|
|
// Checkout info
|
|
|
|