Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion GVFS/GVFS.Build/GVFS.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<PropertyGroup Label="Parameters">
<GVFSVersion>0.2.173.2</GVFSVersion>
<GitPackageVersion>2.20181211.5</GitPackageVersion>
<GitPackageVersion>2.20181213.2</GitPackageVersion>
</PropertyGroup>

<PropertyGroup Label="DefaultSettings">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
using GVFS.FunctionalTests.FileSystemRunners;
using GVFS.FunctionalTests.Should;
using GVFS.FunctionalTests.Tools;
using GVFS.Tests.Should;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;

namespace GVFS.FunctionalTests.Tests.EnlistmentPerFixture
{
[TestFixtureSource(typeof(FileSystemRunner), nameof(FileSystemRunner.Runners))]
Copy link
Member

@wilbaker wilbaker Dec 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to parameterize these tests on FileSystemRunner as they never use this.fileSystem.

[TestFixtureSource(typeof(FileSystemRunner), nameof(FileSystemRunner.Runners))] can be replaced with [TestFixture] and the FileSystemRunner fileSystem parameter can be removed from the constructor.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benpeart I see I was too late with this comment, I will create a PR with this change.

[Category(Categories.GitCommands)]
public class GitBlockCommandsTests : TestsWithEnlistmentPerFixture
{
private FileSystemRunner fileSystem;
public GitBlockCommandsTests(FileSystemRunner fileSystem)
{
this.fileSystem = fileSystem;
}

[TestCase, Order(1)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does order really matter in these tests?

public void GitFsck()
{
ProcessResult result = GitHelpers.InvokeGitAgainstGVFSRepo(
this.Enlistment.RepoRoot,
"fsck");
result.ExitCode.ShouldNotEqual(0, result.Errors);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would maybe add a function that is:

private void CommandBlocked(string command)
{
	ProcessResult result = GitHelpers.InvokeGitAgainstGVFSRepo(
		this.Enlistment.RepoRoot,
		command);
	result.ExitCode.ShouldNotEqual(0, $"Command {command} not blocked when it should be.  Errors: {result.Errors}");
}

And have a similar method for CommandNotBlocked
Then you could have one test case that is:

CommandBlocked("fsck");
CommandBlocked("gc");
CommandNotBlocked("gc --auto");
CommandBlocked("prune");
etc...

}

[TestCase, Order(2)]
public void GitGc()
{
ProcessResult result = GitHelpers.InvokeGitAgainstGVFSRepo(
this.Enlistment.RepoRoot,
"gc");
result.ExitCode.ShouldNotEqual(0, result.Errors);
result = GitHelpers.InvokeGitAgainstGVFSRepo(
this.Enlistment.RepoRoot,
"gc --auto");
result.ExitCode.ShouldEqual(0, result.Errors);
}

[TestCase, Order(3)]
public void GitPrune()
{
ProcessResult result = GitHelpers.InvokeGitAgainstGVFSRepo(
this.Enlistment.RepoRoot,
"prune");
result.ExitCode.ShouldNotEqual(0, result.Errors);
}

[TestCase, Order(4)]
public void GitRepack()
{
ProcessResult result = GitHelpers.InvokeGitAgainstGVFSRepo(
this.Enlistment.RepoRoot,
"repack");
result.ExitCode.ShouldNotEqual(0, result.Errors);
}

[TestCase, Order(5)]
public void GitSubmodule()
{
ProcessResult result = GitHelpers.InvokeGitAgainstGVFSRepo(
this.Enlistment.RepoRoot,
"submodule");
result.ExitCode.ShouldNotEqual(0, result.Errors);
result = GitHelpers.InvokeGitAgainstGVFSRepo(
this.Enlistment.RepoRoot,
"submodule status");
result.ExitCode.ShouldNotEqual(0, result.Errors);
}

[TestCase, Order(6)]
public void GitUpdateIndex()
{
ProcessResult result = GitHelpers.InvokeGitAgainstGVFSRepo(
this.Enlistment.RepoRoot,
"update-index --index-version 2");
result.ExitCode.ShouldNotEqual(0, result.Errors);
result = GitHelpers.InvokeGitAgainstGVFSRepo(
this.Enlistment.RepoRoot,
"update-index --skip-worktree");
result.ExitCode.ShouldNotEqual(0, result.Errors);
result = GitHelpers.InvokeGitAgainstGVFSRepo(
this.Enlistment.RepoRoot,
"update-index --no-skip-worktree");
result.ExitCode.ShouldNotEqual(0, result.Errors);
result = GitHelpers.InvokeGitAgainstGVFSRepo(
this.Enlistment.RepoRoot,
"update-index --split-index");
result.ExitCode.ShouldNotEqual(0, result.Errors);
}

[TestCase, Order(7)]
public void GitWorktree()
{
ProcessResult result = GitHelpers.InvokeGitAgainstGVFSRepo(
this.Enlistment.RepoRoot,
"worktree list");
result.ExitCode.ShouldNotEqual(0, result.Errors);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1036,10 +1036,10 @@ public void RenameOnlyFileInFolder()
public void UpdateIndexCannotModifySkipWorktreeBit()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a duplicate test to the ones you added? If so I would just delete it.

{
ProcessResult result = GitHelpers.InvokeGitAgainstGVFSRepo(this.Enlistment.RepoRoot, "update-index --skip-worktree Readme.md");
result.Errors.ShouldContain("Modifying the skip worktree bit is not supported on a GVFS repo");
result.ExitCode.ShouldNotEqual(0);

result = GitHelpers.InvokeGitAgainstGVFSRepo(this.Enlistment.RepoRoot, "update-index --no-skip-worktree Readme.md");
result.Errors.ShouldContain("Modifying the skip worktree bit is not supported on a GVFS repo");
result.ExitCode.ShouldNotEqual(0);
}

[TestCase]
Expand Down
35 changes: 0 additions & 35 deletions GVFS/GVFS.Hooks/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,45 +133,10 @@ private static void CheckForLegalCommands(string[] args)
string command = GetGitCommand(args);
switch (command)
{
case "update-index":
if (ContainsArg(args, "--split-index") ||
ContainsArg(args, "--no-split-index"))
{
ExitWithError("Split index is not supported on a GVFS repo");
}

if (ContainsArg(args, "--index-version"))
{
ExitWithError("Changing the index version is not supported on a GVFS repo");
}

if (ContainsArg(args, "--skip-worktree") ||
ContainsArg(args, "--no-skip-worktree"))
{
ExitWithError("Modifying the skip worktree bit is not supported on a GVFS repo");
}

break;

case "fsck":
case "gc":
case "prune":
case "repack":
ExitWithError("'git " + command + "' is not supported on a GVFS repo");
break;

case "submodule":
ExitWithError("Submodule operations are not supported on a GVFS repo");
break;

case "status":
VerifyRenameDetectionSettings(args);
break;

case "worktree":
ExitWithError("Worktree operations are not supported on a GVFS repo");
break;

case "gui":
ExitWithError("To access the 'git gui' in a GVFS repo, please invoke 'git-gui.exe' instead.");
break;
Expand Down