mirror of
https://code.forgejo.org/actions/checkout.git
synced 2026-02-27 13:35:42 +00:00
Thread showProgress through checkout and fix fetch progress flag
- Make checkout() and checkoutDetach() accept showProgress so callers can opt into --progress output; default remains --quiet - Pass settings.showProgress to checkout() from git-source-provider - Fix fetchOptions.showProgress not being set (was always undefined) - Rebuild dist Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
153bc0ba7c
commit
f3b6b37fa6
3 changed files with 19 additions and 12 deletions
13
dist/index.js
vendored
13
dist/index.js
vendored
|
|
@ -780,9 +780,9 @@ class GitCommandManager {
|
||||||
yield fs.promises.appendFile(sparseCheckoutPath, `\n${sparseCheckout.join('\n')}\n`);
|
yield fs.promises.appendFile(sparseCheckoutPath, `\n${sparseCheckout.join('\n')}\n`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
checkout(ref, startPoint) {
|
checkout(ref, startPoint, showProgress) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const args = ['checkout', '--progress', '--force'];
|
const args = ['checkout', showProgress ? '--progress' : '--quiet', '--force'];
|
||||||
if (startPoint) {
|
if (startPoint) {
|
||||||
args.push('-B', ref, startPoint);
|
args.push('-B', ref, startPoint);
|
||||||
}
|
}
|
||||||
|
|
@ -792,9 +792,9 @@ class GitCommandManager {
|
||||||
yield this.execGit(args);
|
yield this.execGit(args);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
checkoutDetach() {
|
checkoutDetach(showProgress) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const args = ['checkout', '--detach'];
|
const args = ['checkout', '--detach', showProgress ? '--progress' : '--quiet'];
|
||||||
yield this.execGit(args);
|
yield this.execGit(args);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -1523,6 +1523,9 @@ function getSource(settings) {
|
||||||
// Fetch
|
// Fetch
|
||||||
core.startGroup('Fetching the repository');
|
core.startGroup('Fetching the repository');
|
||||||
const fetchOptions = {};
|
const fetchOptions = {};
|
||||||
|
if (settings.showProgress) {
|
||||||
|
fetchOptions.showProgress = true;
|
||||||
|
}
|
||||||
if (settings.filter) {
|
if (settings.filter) {
|
||||||
fetchOptions.filter = settings.filter;
|
fetchOptions.filter = settings.filter;
|
||||||
}
|
}
|
||||||
|
|
@ -1593,7 +1596,7 @@ function getSource(settings) {
|
||||||
}
|
}
|
||||||
// Checkout
|
// Checkout
|
||||||
core.startGroup('Checking out the ref');
|
core.startGroup('Checking out the ref');
|
||||||
yield git.checkout(checkoutInfo.ref, checkoutInfo.startPoint);
|
yield git.checkout(checkoutInfo.ref, checkoutInfo.startPoint, settings.showProgress);
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
// Submodules
|
// Submodules
|
||||||
if (settings.submodules) {
|
if (settings.submodules) {
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@ export interface IGitCommandManager {
|
||||||
disableSparseCheckout(): Promise<void>
|
disableSparseCheckout(): Promise<void>
|
||||||
sparseCheckout(sparseCheckout: string[]): Promise<void>
|
sparseCheckout(sparseCheckout: string[]): Promise<void>
|
||||||
sparseCheckoutNonConeMode(sparseCheckout: string[]): Promise<void>
|
sparseCheckoutNonConeMode(sparseCheckout: string[]): Promise<void>
|
||||||
checkout(ref: string, startPoint: string): Promise<void>
|
checkout(ref: string, startPoint: string, showProgress?: boolean): Promise<void>
|
||||||
checkoutDetach(): Promise<void>
|
checkoutDetach(showProgress?: boolean): Promise<void>
|
||||||
config(
|
config(
|
||||||
configKey: string,
|
configKey: string,
|
||||||
configValue: string,
|
configValue: string,
|
||||||
|
|
@ -220,8 +220,8 @@ class GitCommandManager {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkout(ref: string, startPoint: string): Promise<void> {
|
async checkout(ref: string, startPoint: string, showProgress?: boolean): Promise<void> {
|
||||||
const args = ['checkout', '--quiet', '--force']
|
const args = ['checkout', showProgress ? '--progress' : '--quiet', '--force']
|
||||||
if (startPoint) {
|
if (startPoint) {
|
||||||
args.push('-B', ref, startPoint)
|
args.push('-B', ref, startPoint)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -231,8 +231,8 @@ class GitCommandManager {
|
||||||
await this.execGit(args)
|
await this.execGit(args)
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkoutDetach(): Promise<void> {
|
async checkoutDetach(showProgress?: boolean): Promise<void> {
|
||||||
const args = ['checkout', '--detach', '--quiet']
|
const args = ['checkout', '--detach', showProgress ? '--progress' : '--quiet']
|
||||||
await this.execGit(args)
|
await this.execGit(args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -162,6 +162,10 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
||||||
showProgress?: boolean
|
showProgress?: boolean
|
||||||
} = {}
|
} = {}
|
||||||
|
|
||||||
|
if (settings.showProgress) {
|
||||||
|
fetchOptions.showProgress = true
|
||||||
|
}
|
||||||
|
|
||||||
if (settings.filter) {
|
if (settings.filter) {
|
||||||
fetchOptions.filter = settings.filter
|
fetchOptions.filter = settings.filter
|
||||||
} else if (settings.sparseCheckout) {
|
} else if (settings.sparseCheckout) {
|
||||||
|
|
@ -251,7 +255,7 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
||||||
|
|
||||||
// Checkout
|
// Checkout
|
||||||
core.startGroup('Checking out the ref')
|
core.startGroup('Checking out the ref')
|
||||||
await git.checkout(checkoutInfo.ref, checkoutInfo.startPoint)
|
await git.checkout(checkoutInfo.ref, checkoutInfo.startPoint, settings.showProgress)
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
|
|
||||||
// Submodules
|
// Submodules
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue