mirror of
https://github.com/actions/checkout.git
synced 2026-11-16 22:45:08 +08:00
Allow filter: none to disable the implicit blob:none for sparse checkout
When sparse-checkout is set and filter is not, checkout fetches with --filter=blob:none. If the sparse patterns keep most of the repository, the following checkout fetches each blob lazily from the promisor remote, which is slower than one full pack. Setting filter to 'none' now fetches without a filter. 'none' is not a valid git filter-spec, so no existing workflow can depend on it. The effective filter is now resolved in input-helper, so git-source-provider has one decision point.
This commit is contained in:
parent
f548e57e54
commit
4fba4c42af
8 changed files with 110 additions and 22 deletions
|
|
@ -215,6 +215,47 @@ describe('input-helper tests', () => {
|
|||
expect(settings.commit).toBe('1111111111222222222233333333334444444444')
|
||||
})
|
||||
|
||||
describe('filter', () => {
|
||||
it('is not set without sparse checkout', async () => {
|
||||
const settings: IGitSourceSettings = await inputHelper.getInputs()
|
||||
expect(settings.filter).toBe(undefined)
|
||||
})
|
||||
|
||||
it('defaults to blob:none with sparse checkout', async () => {
|
||||
inputs['sparse-checkout'] = 'src\ndocs'
|
||||
const settings: IGitSourceSettings = await inputHelper.getInputs()
|
||||
expect(settings.sparseCheckout).toEqual(['src', 'docs'])
|
||||
expect(settings.filter).toBe('blob:none')
|
||||
})
|
||||
|
||||
it('uses the given filter with sparse checkout', async () => {
|
||||
inputs['sparse-checkout'] = 'src'
|
||||
inputs.filter = 'tree:0'
|
||||
const settings: IGitSourceSettings = await inputHelper.getInputs()
|
||||
expect(settings.filter).toBe('tree:0')
|
||||
})
|
||||
|
||||
it('uses the given filter without sparse checkout', async () => {
|
||||
inputs.filter = 'blob:limit=1m'
|
||||
const settings: IGitSourceSettings = await inputHelper.getInputs()
|
||||
expect(settings.filter).toBe('blob:limit=1m')
|
||||
})
|
||||
|
||||
it('is not set when none with sparse checkout', async () => {
|
||||
inputs['sparse-checkout'] = 'src'
|
||||
inputs.filter = 'none'
|
||||
const settings: IGitSourceSettings = await inputHelper.getInputs()
|
||||
expect(settings.sparseCheckout).toEqual(['src'])
|
||||
expect(settings.filter).toBe(undefined)
|
||||
})
|
||||
|
||||
it('is not set when none without sparse checkout', async () => {
|
||||
inputs.filter = 'None'
|
||||
const settings: IGitSourceSettings = await inputHelper.getInputs()
|
||||
expect(settings.filter).toBe(undefined)
|
||||
})
|
||||
})
|
||||
|
||||
it('sets workflow organization ID', async () => {
|
||||
const settings: IGitSourceSettings = await inputHelper.getInputs()
|
||||
expect(settings.workflowOrganizationId).toBe(123456)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue