1
0
Fork 0
mirror of https://code.forgejo.org/actions/checkout.git synced 2025-08-14 17:30:50 +00:00

try preserve local changes option

This commit is contained in:
Salman Muin Kayser Chishti 2025-08-11 12:21:31 +01:00
parent 9f265659d3
commit 45fe6460ed
6 changed files with 59 additions and 6 deletions

View file

@ -22,7 +22,7 @@ export interface IGitCommandManager {
disableSparseCheckout(): Promise<void>
sparseCheckout(sparseCheckout: string[]): Promise<void>
sparseCheckoutNonConeMode(sparseCheckout: string[]): Promise<void>
checkout(ref: string, startPoint: string): Promise<void>
checkout(ref: string, startPoint: string, options?: string[]): Promise<void>
checkoutDetach(): Promise<void>
config(
configKey: string,
@ -203,8 +203,21 @@ class GitCommandManager {
)
}
async checkout(ref: string, startPoint: string): Promise<void> {
const args = ['checkout', '--progress', '--force']
async checkout(
ref: string,
startPoint: string,
options: string[] = []
): Promise<void> {
const args = ['checkout', '--progress']
// Add custom options (like --merge) if provided
if (options.length > 0) {
args.push(...options)
} else {
// Default behavior - use force
args.push('--force')
}
if (startPoint) {
args.push('-B', ref, startPoint)
} else {