mirror of
https://code.forgejo.org/actions/checkout.git
synced 2025-04-21 09:10:16 +03:00
Check git version before attempting to disable sparse-checkout
(#1656)
* Check git version before attempting to disable `sparse-checkout` * Bump `MinimumGitSparseCheckoutVersion` to 2.28 due to #1386 * Initial prep for release 4.1.3
This commit is contained in:
parent
8410ad0602
commit
cd7d8d697e
8 changed files with 97 additions and 30 deletions
|
@ -9,7 +9,10 @@ import * as path from 'path'
|
|||
import * as refHelper from './ref-helper'
|
||||
import * as stateHelper from './state-helper'
|
||||
import * as urlHelper from './url-helper'
|
||||
import {IGitCommandManager} from './git-command-manager'
|
||||
import {
|
||||
MinimumGitSparseCheckoutVersion,
|
||||
IGitCommandManager
|
||||
} from './git-command-manager'
|
||||
import {IGitSourceSettings} from './git-source-settings'
|
||||
|
||||
export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
||||
|
@ -209,7 +212,11 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
|||
|
||||
// Sparse checkout
|
||||
if (!settings.sparseCheckout) {
|
||||
await git.disableSparseCheckout()
|
||||
let gitVersion = await git.version()
|
||||
// no need to disable sparse-checkout if the installed git runtime doesn't even support it.
|
||||
if (gitVersion.checkMinimum(MinimumGitSparseCheckoutVersion)) {
|
||||
await git.disableSparseCheckout()
|
||||
}
|
||||
} else {
|
||||
core.startGroup('Setting up sparse checkout')
|
||||
if (settings.sparseCheckoutConeMode) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue