public void GitStatusAndObjectAfterGitAdd() { string existingFilename = "test.cs"; this.Enlistment.GetSourcePath(existingFilename).ShouldBeAFile(this.fileSystem); GitHelpers.CheckGitCommandAgainstScalarRepo( this.Enlistment.RepoRoot, "add " + existingFilename, new string[] { }); // Status should be correct GitHelpers.CheckGitCommandAgainstScalarRepo( this.Enlistment.RepoRoot, "status", "On branch " + Properties.Settings.Default.Commitish, "Changes to be committed:", existingFilename); // Object file for the test file should have the correct contents ProcessResult result = GitHelpers.InvokeGitAgainstScalarRepo( this.Enlistment.RepoRoot, "hash-object " + existingFilename); string objectHash = result.Output.Trim(); result.Errors.ShouldBeEmpty(); this.Enlistment.GetObjectPathTo(objectHash).ShouldBeAFile(this.fileSystem); GitHelpers.CheckGitCommandAgainstScalarRepo( this.Enlistment.RepoRoot, "cat-file -p " + objectHash, this.testFileContents); }
public void GitStatusAfterRenameFolderIntoRepo() { string folderName = "GitStatusAfterRenameFolderIntoRepo"; // Create the test folder in this.Enlistment.EnlistmentRoot as it's outside of src // and is cleaned up when the functional tests run string folderPath = Path.Combine(this.Enlistment.EnlistmentRoot, folderName); this.fileSystem.CreateDirectory(folderPath); string fileName = "GitStatusAfterRenameFolderIntoRepo_file.txt"; string filePath = Path.Combine(folderPath, fileName); this.fileSystem.WriteAllText(filePath, this.testFileContents); filePath.ShouldBeAFile(this.fileSystem).WithContents(this.testFileContents); this.fileSystem.MoveDirectory(folderPath, this.Enlistment.GetSourcePath(folderName)); GitHelpers.CheckGitCommandAgainstScalarRepo( this.Enlistment.RepoRoot, "status -uall", "On branch " + Properties.Settings.Default.Commitish, "Untracked files:", folderName + "/", folderName + "/" + fileName); }
public void GitStatusAfterRenameFileIntoRepo() { string filename = "GitStatusAfterRenameFileIntoRepo.cs"; // Create the test file in this.Enlistment.EnlistmentRoot as it's outside of src // and is cleaned up when the functional tests run string filePath = Path.Combine(this.Enlistment.EnlistmentRoot, filename); this.fileSystem.WriteAllText(filePath, this.testFileContents); filePath.ShouldBeAFile(this.fileSystem).WithContents(this.testFileContents); string renamedFileName = Path.Combine("GVFlt_MoveFileTest", "GitStatusAfterRenameFileIntoRepo.cs"); string renamedFilePath = this.Enlistment.GetSourcePath(renamedFileName); this.fileSystem.MoveFile(filePath, renamedFilePath); filePath.ShouldNotExistOnDisk(this.fileSystem); renamedFilePath.ShouldBeAFile(this.fileSystem); GitHelpers.CheckGitCommandAgainstScalarRepo( this.Enlistment.RepoRoot, "status", "On branch " + Properties.Settings.Default.Commitish, "Untracked files:", renamedFileName.Replace('\\', '/')); }
public void GitStatus() { GitHelpers.CheckGitCommandAgainstScalarRepo( this.Enlistment.RepoRoot, "status", "On branch " + Properties.Settings.Default.Commitish, "nothing to commit, working tree clean"); }
public void GitStatusAfterFileDelete() { string existingFilename = "test.cs"; this.EnsureTestFileExists(existingFilename); this.fileSystem.DeleteFile(this.Enlistment.GetSourcePath(existingFilename)); this.Enlistment.GetSourcePath(existingFilename).ShouldNotExistOnDisk(this.fileSystem); GitHelpers.CheckGitCommandAgainstScalarRepo( this.Enlistment.RepoRoot, "status", "On branch " + Properties.Settings.Default.Commitish, "nothing to commit, working tree clean"); }
public void GitStatusAfterFileRename() { string oldFilename = "New.cs"; this.EnsureTestFileExists(oldFilename); string newFilename = "test.cs"; string newFilePath = this.Enlistment.GetSourcePath(newFilename); this.fileSystem.MoveFile(this.Enlistment.GetSourcePath(oldFilename), newFilePath); GitHelpers.CheckGitCommandAgainstScalarRepo( this.Enlistment.RepoRoot, "status", "On branch " + Properties.Settings.Default.Commitish, "Untracked files:", newFilename); }
public void GitStatusAfterUnstage() { string existingFilename = "test.cs"; this.Enlistment.GetSourcePath(existingFilename).ShouldBeAFile(this.fileSystem); GitHelpers.CheckGitCommandAgainstScalarRepo( this.Enlistment.RepoRoot, "reset HEAD " + existingFilename, new string[] { }); GitHelpers.CheckGitCommandAgainstScalarRepo( this.Enlistment.RepoRoot, "status", "On branch " + Properties.Settings.Default.Commitish, "Untracked files:", existingFilename); }
public void GitStatusAfterNewFile() { string filename = "new.cs"; string filePath = this.Enlistment.GetSourcePath(filename); filePath.ShouldNotExistOnDisk(this.fileSystem); this.fileSystem.WriteAllText(filePath, this.testFileContents); filePath.ShouldBeAFile(this.fileSystem).WithContents(this.testFileContents); GitHelpers.CheckGitCommandAgainstScalarRepo( this.Enlistment.RepoRoot, "status", "On branch " + Properties.Settings.Default.Commitish, "Untracked files:", filename); this.fileSystem.DeleteFile(filePath); }