mirror of
https://github.com/actions/checkout.git
synced 2026-11-16 14:35:03 +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
|
|
@ -401,6 +401,41 @@ describe('Test fetchDepth and fetchTags options', () => {
|
|||
expect.any(Object)
|
||||
)
|
||||
})
|
||||
|
||||
it('should not pass --filter when filter is not set', async () => {
|
||||
// exec.exec is already mockExec
|
||||
const workingDirectory = 'test'
|
||||
const lfs = false
|
||||
const doSparseCheckout = false
|
||||
git = await commandManager.createCommandManager(
|
||||
workingDirectory,
|
||||
lfs,
|
||||
doSparseCheckout
|
||||
)
|
||||
|
||||
const refSpec = ['refspec1']
|
||||
const options = {
|
||||
fetchDepth: 1
|
||||
}
|
||||
|
||||
await git.fetch(refSpec, options)
|
||||
|
||||
expect(mockExec).toHaveBeenCalledWith(
|
||||
expect.any(String),
|
||||
[
|
||||
'-c',
|
||||
'protocol.version=2',
|
||||
'fetch',
|
||||
'--no-tags',
|
||||
'--prune',
|
||||
'--no-recurse-submodules',
|
||||
'--depth=1',
|
||||
'origin',
|
||||
'refspec1'
|
||||
],
|
||||
expect.any(Object)
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('repository initialization object format', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue