Skip to content

Instantly share code, notes, and snippets.

@mikeblakeuk
Created October 25, 2022 19:16
Show Gist options
  • Save mikeblakeuk/4f073d92904db135edbaa6689154bec0 to your computer and use it in GitHub Desktop.
Save mikeblakeuk/4f073d92904db135edbaa6689154bec0 to your computer and use it in GitHub Desktop.
Fast sparse Checkout for Azure DevOps
parameters:
folders: '*'
steps:
- bash: |
set -ex
export ORIGIN=$(Build.Repository.Uri)
export REF=$(Build.SourceVersion)
export FOLDERS='${{ parameters.folders }}'
git version
git lfs version
git init
git sparse-checkout init --cone
git sparse-checkout add $FOLDERS
git remote add origin $ORIGIN
git config core.sparsecheckout true
git config gc.auto 0
git config advice.detachedHead false
git config http.version HTTP/1.1
git lfs install --local
git config uploadpack.allowReachableSHA1InWant true
git config http.extraheader "AUTHORIZATION: bearer $(System.AccessToken)"
git fetch --force --no-tags --progress --depth 1 origin develop $REF
git checkout $REF --progress --force
displayName: Fast sparse Checkout
steps:
- checkout: none
- template: fastCheckout.yaml
parameters:
folders: 'Folder1 src/Folder2'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment