-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update projection to use the included folders
- Loading branch information
Kevin Willford
committed
Aug 5, 2019
1 parent
0800b48
commit 73a5772
Showing
5 changed files
with
209 additions
and
1 deletion.
There are no files selected for viewing
79 changes: 79 additions & 0 deletions
79
GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/IncludedFolderTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
using GVFS.FunctionalTests.FileSystemRunners; | ||
using GVFS.FunctionalTests.Should; | ||
using GVFS.FunctionalTests.Tools; | ||
using GVFS.Tests.Should; | ||
using NUnit.Framework; | ||
using System.IO; | ||
|
||
namespace GVFS.FunctionalTests.Tests.EnlistmentPerFixture | ||
{ | ||
[TestFixture] | ||
public class IncludedFolderTests : TestsWithEnlistmentPerFixture | ||
{ | ||
private FileSystemRunner fileSystem = new SystemIORunner(); | ||
|
||
[TestCase] | ||
public void BasicTestsAddingAndRemoving() | ||
{ | ||
// directories before limiting them | ||
string[] allRootDirectories = Directory.GetDirectories(this.Enlistment.RepoRoot); | ||
string[] directoriesForParentAdd = Directory.GetDirectories(Path.Combine(this.Enlistment.RepoRoot, "GVFS", "GVFS")); | ||
|
||
GVFSProcess gvfsProcess = new GVFSProcess(this.Enlistment); | ||
gvfsProcess.AddIncludedFolders(Path.Combine("GVFS", "GVFS")); | ||
|
||
string[] directories = Directory.GetDirectories(this.Enlistment.RepoRoot); | ||
directories.Length.ShouldEqual(2); | ||
directories[0].ShouldEqual(Path.Combine(this.Enlistment.RepoRoot, ".git")); | ||
directories[1].ShouldEqual(Path.Combine(this.Enlistment.RepoRoot, "GVFS")); | ||
|
||
string folder = this.Enlistment.GetVirtualPathTo("GVFS", "GVFS"); | ||
folder.ShouldBeADirectory(this.fileSystem); | ||
folder = this.Enlistment.GetVirtualPathTo("GVFS", "GVFS", "CommandLine"); | ||
folder.ShouldBeADirectory(this.fileSystem); | ||
|
||
folder = this.Enlistment.GetVirtualPathTo("Scripts"); | ||
folder.ShouldNotExistOnDisk(this.fileSystem); | ||
|
||
// Remove the last directory should make all folders appear again | ||
gvfsProcess.RemoveIncludedFolders(Path.Combine("GVFS", "GVFS")); | ||
directories = Directory.GetDirectories(this.Enlistment.RepoRoot); | ||
directories.ShouldMatchInOrder(allRootDirectories); | ||
|
||
// Add parent directory should make the parent recursive | ||
gvfsProcess.AddIncludedFolders(Path.Combine("GVFS", "GVFS", "CommandLine")); | ||
directories = Directory.GetDirectories(Path.Combine(this.Enlistment.RepoRoot, "GVFS", "GVFS")); | ||
directories.Length.ShouldEqual(1); | ||
directories[0].ShouldEqual(Path.Combine(this.Enlistment.RepoRoot, "GVFS", "GVFS", "CommandLine")); | ||
|
||
gvfsProcess.AddIncludedFolders(Path.Combine("GVFS", "GVFS")); | ||
directories = Directory.GetDirectories(Path.Combine(this.Enlistment.RepoRoot, "GVFS", "GVFS")); | ||
directories.ShouldMatchInOrder(directoriesForParentAdd); | ||
|
||
// Add and remove folder | ||
gvfsProcess.AddIncludedFolders("Scripts"); | ||
folder.ShouldBeADirectory(this.fileSystem); | ||
|
||
gvfsProcess.RemoveIncludedFolders("Scripts"); | ||
folder.ShouldNotExistOnDisk(this.fileSystem); | ||
|
||
// Add and remove sibling folder to GVFS/GVFS | ||
gvfsProcess.AddIncludedFolders(Path.Combine("GVFS", "FastFetch")); | ||
folder = this.Enlistment.GetVirtualPathTo("GVFS", "FastFetch"); | ||
folder.ShouldBeADirectory(this.fileSystem); | ||
|
||
gvfsProcess.RemoveIncludedFolders(Path.Combine("GVFS", "FastFetch")); | ||
folder.ShouldNotExistOnDisk(this.fileSystem); | ||
folder = this.Enlistment.GetVirtualPathTo("GVFS", "GVFS"); | ||
folder.ShouldBeADirectory(this.fileSystem); | ||
|
||
// Add subfolder of GVFS/GVFS and make sure it stays recursive | ||
gvfsProcess.AddIncludedFolders(Path.Combine("GVFS", "GVFS", "Properties")); | ||
folder = this.Enlistment.GetVirtualPathTo("GVFS", "GVFS", "Properties"); | ||
folder.ShouldBeADirectory(this.fileSystem); | ||
|
||
folder = this.Enlistment.GetVirtualPathTo("GVFS", "GVFS", "CommandLine"); | ||
folder.ShouldBeADirectory(this.fileSystem); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
GVFS/GVFS.Virtualization/Projection/GitIndexProjection.IncludedFolder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace GVFS.Virtualization.Projection | ||
{ | ||
public partial class GitIndexProjection | ||
{ | ||
internal class IncludedFolderData | ||
{ | ||
public IncludedFolderData() | ||
{ | ||
this.Children = new Dictionary<string, IncludedFolderData>(); | ||
} | ||
|
||
public bool IsRecursive { get; set; } | ||
public Dictionary<string, IncludedFolderData> Children { get; } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters