From 8448649af70a463572fce9c3623cc5814dbbff3d Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Thu, 2 Jun 2022 12:16:14 -0700 Subject: [PATCH] Disable detached head warnings on sparse checkout to commit (#29100) Co-authored-by: Ben Broderick Phillips --- 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 69db80fc82de4..49f9eb553b042 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" }