Skip to content

Commit 6747421

Browse files
committed
Prevent multiple enumerations
1 parent 431e9c6 commit 6747421

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

LibGit2Sharp/Repository.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,14 +1006,17 @@ public void CheckoutPaths(string committishOrBranchSpec, IEnumerable<string> pat
10061006
Ensure.ArgumentNotNullOrEmptyString(committishOrBranchSpec, "committishOrBranchSpec");
10071007
Ensure.ArgumentNotNull(paths, "paths");
10081008

1009+
var listOfPaths = paths.ToList();
1010+
10091011
// If there are no paths, then there is nothing to do.
1010-
if (!paths.Any())
1012+
if (listOfPaths.Count == 0)
10111013
{
10121014
return;
10131015
}
10141016

10151017
Commit commit = LookupCommit(committishOrBranchSpec);
1016-
CheckoutTree(commit.Tree, paths.ToList(), checkoutOptions ?? new CheckoutOptions());
1018+
1019+
CheckoutTree(commit.Tree, listOfPaths, checkoutOptions ?? new CheckoutOptions());
10171020
}
10181021

10191022
/// <summary>

0 commit comments

Comments
 (0)