Skip to content

Commit 502398b

Browse files
committed
Use switch case for checkout strategy and disable sparse-checkout for CheckoutStrategy.Full
1 parent fbb5a14 commit 502398b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/tooling/docs-assembler/Sourcing/RepositorySourcesFetcher.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,17 @@ private bool GitInit(Repository repository, IDirectoryInfo checkoutFolder)
196196
private void FetchAndCheckout(Repository repository, string gitRef, IDirectoryInfo checkoutFolder)
197197
{
198198
ExecIn(checkoutFolder, "git", "fetch", "--no-tags", "--prune", "--no-recurse-submodules", "--depth", "1", "origin", gitRef);
199-
if (repository.CheckoutStrategy == CheckoutStrategy.Partial)
200-
ExecIn(checkoutFolder, "git", "sparse-checkout", "set", "docs");
199+
switch (repository.CheckoutStrategy)
200+
{
201+
case CheckoutStrategy.Full:
202+
ExecIn(checkoutFolder, "git", "sparse-checkout", "disable");
203+
break;
204+
case CheckoutStrategy.Partial:
205+
ExecIn(checkoutFolder, "git", "sparse-checkout", "set", "docs");
206+
break;
207+
default:
208+
throw new ArgumentOutOfRangeException(nameof(repository), repository.CheckoutStrategy, null);
209+
}
201210
ExecIn(checkoutFolder, "git", "checkout", "--force", gitRef);
202211
}
203212

0 commit comments

Comments
 (0)