Skip to content

Commit

Permalink
Select smallest pack in LooseObjectsStepTests
Browse files Browse the repository at this point in the history
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
  • Loading branch information
derrickstolee committed Aug 15, 2019
1 parent 83f8c53 commit 557fe5b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,10 @@ private void ExpandOneTempPack(bool copyPackBackToPackDirectory)
string[] packFiles = Directory.GetFiles(this.TempPackRoot, "pack-*.pack");
Assert.Greater(packFiles.Length, 0);

// Pick the first one found
string packFile = packFiles[0];
List<FileInfo> fileInfos = packFiles.Select(file => new FileInfo(file))
.ToList();
fileInfos.Sort((f1, f2) => (int)(f2.Length - f1.Length));
string packFile = fileInfos[0].FullName;

// Send the contents of the packfile to unpack-objects to example the loose objects
// Note this won't work if the object exists in a pack file which is why we had to move them
Expand Down

0 comments on commit 557fe5b

Please sign in to comment.