Skip to content

Commit f2889ae

Browse files
semihokurSanju Yadav
authored andcommitted
Address feedback
1 parent f50f3e3 commit f2889ae

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Agent.Plugins/GitSourceProvider.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -618,12 +618,13 @@ public async Task GetSourceAsync(
618618
}
619619
}
620620

621-
if (Directory.GetParent(targetPath) is DirectoryInfo parent
622-
&& File.Exists(Path.Combine(parent.FullName, ".autoManagedVhd"))
621+
string agentWorkFolder = Environment.GetEnvironmentVariable("AGENT_WORKFOLDER");
622+
if (!string.IsNullOrEmpty(agentWorkFolder)
623+
&& File.Exists(Path.Combine(agentWorkFolder, ".autoManagedVhd"))
623624
&& !AgentKnobs.DisableAutoManagedVhdShallowOverride.GetValue(executionContext).AsBoolean())
624625
{
625626
// The existing working directory comes from an AutoManagedVHD (indicated by the
626-
// .autoManagedVhd marker file placed in the parent directory of the sources).
627+
// .autoManagedVhd marker file placed in the agent work folder).
627628
// An AutoManagedVHD always contains a full, non-shallow clone of the repository.
628629
// Some pipelines enable shallow fetch parameters (e.g., fetchDepth > 0). However,
629630
// Git cannot convert an existing full clone into a shallow one in-place.

0 commit comments

Comments
 (0)