added filter option & tests

This commit is contained in:
Finley Garton 2023-06-30 17:12:38 +01:00
parent 96f53100ba
commit 99fc22de1f
No known key found for this signature in database
GPG key ID: 8D1E50A9A9B1C522
7 changed files with 46 additions and 1 deletions

View file

@ -154,7 +154,13 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
// Fetch
core.startGroup('Fetching the repository')
const fetchOptions: {filter?: string; fetchDepth?: number} = {}
if (settings.sparseCheckout) fetchOptions.filter = 'blob:none'
if (settings.filter) {
fetchOptions.filter = settings.filter
} else if (settings.sparseCheckout) {
fetchOptions.filter = 'blob:none'
}
if (settings.fetchDepth <= 0) {
// Fetch all branches and tags
let refSpec = refHelper.getRefSpecForAllHistory(