File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -618,12 +618,16 @@ public async Task GetSourceAsync(
618618 }
619619 }
620620
621- if ( File . Exists ( Path . Combine ( targetPath , ".autoManagedVhd" ) )
621+ string agentWorkFolder = executionContext . Variables . GetValueOrDefault ( "agent.workfolder" ) ? . Value ;
622+ if ( ! string . IsNullOrEmpty ( agentWorkFolder )
623+ && File . Exists ( Path . Combine ( agentWorkFolder , ".autoManagedVhd" ) )
622624 && ! AgentKnobs . DisableAutoManagedVhdShallowOverride . GetValue ( executionContext ) . AsBoolean ( ) )
623625 {
624- // The existing working directory comes from an auto-managed VHD and is a full,
625- // non-shallow clone of the repository. Some pipelines enable shallow fetch, but
626- // Git cannot convert an existing full clone into a shallow one in-place.
626+ // The existing working directory comes from an AutoManagedVHD (indicated by the
627+ // .autoManagedVhd marker file placed in the agent work folder).
628+ // An AutoManagedVHD always contains a full, non-shallow clone of the repository.
629+ // Some pipelines enable shallow fetch parameters (e.g., fetchDepth > 0). However,
630+ // Git cannot convert an existing full clone into a shallow one in-place.
627631 //
628632 // Technical reason:
629633 // A full clone already has complete commit history and object reachability.
You can’t perform that action at this time.
0 commit comments