From b4bc6ebdaeeeaf0f3b56dd599660e16f179c0b9d Mon Sep 17 00:00:00 2001 From: Ben Broderick Phillips Date: Wed, 25 May 2022 20:17:26 -0700 Subject: [PATCH] Disable detached head warnings on sparse checkout to commit --- eng/common/pipelines/templates/steps/sparse-checkout.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eng/common/pipelines/templates/steps/sparse-checkout.yml b/eng/common/pipelines/templates/steps/sparse-checkout.yml index 69db80fc82..49f9eb553b 100644 --- a/eng/common/pipelines/templates/steps/sparse-checkout.yml +++ b/eng/common/pipelines/templates/steps/sparse-checkout.yml @@ -59,8 +59,9 @@ steps: # sparse-checkout commands after initial checkout will auto-checkout again if (!$hasInitialized) { - Write-Host "git checkout $($repository.Commitish)" - git checkout $($repository.Commitish) # this will use the default branch if repo.Commitish is empty + Write-Host "git -c advice.detachedHead=false checkout $($repository.Commitish)" + # This will use the default branch if repo.Commitish is empty + git -c advice.detachedHead=false checkout $($repository.Commitish) } else { Write-Host "Skipping checkout as repo has already been initialized" }