Exemplo n.º 1
0
        private void GitCommandWaitsForLock(string gitWorkingDirectory)
        {
            ManualResetEventSlim resetEvent = GitHelpers.AcquireGSDLock(this.Enlistment, out _, resetTimeout: 3000);
            ProcessResult        statusWait = GitHelpers.InvokeGitAgainstGSDRepo(gitWorkingDirectory, "status", removeWaitingMessages: false);

            statusWait.Errors.ShouldContain(ExpectedStatusWaitingText);
            resetEvent.Set();
            this.Enlistment.WaitForBackgroundOperations();
        }
Exemplo n.º 2
0
        public void UnmountSkipLock()
        {
            ManualResetEventSlim lockHolder = GitHelpers.AcquireGSDLock(this.Enlistment, out _, Timeout.Infinite, true);

            using (Process unmountingProcess = this.StartUnmount("--skip-wait-for-lock"))
            {
                unmountingProcess.WaitForExit(10000).ShouldEqual(true, "Unmount didn't complete as expected.");
            }

            // Signal process holding lock to terminate and release lock.
            lockHolder.Set();
        }
Exemplo n.º 3
0
        public void UnmountWaitsForLock()
        {
            ManualResetEventSlim lockHolder = GitHelpers.AcquireGSDLock(this.Enlistment, out _);

            using (Process unmountingProcess = this.StartUnmount())
            {
                unmountingProcess.WaitForExit(3000).ShouldEqual(false, "Unmount completed while lock was acquired.");

                // Release the lock.
                lockHolder.Set();

                unmountingProcess.WaitForExit(10000).ShouldEqual(true, "Unmount didn't complete as expected.");
            }
        }
Exemplo n.º 4
0
        public void ModifiedFileWillGetAddedToModifiedPathsFile()
        {
            string gitFileToTest = "GVFS/GVFS.Common/RetryWrapper.cs";
            string fileToCreate  = this.Enlistment.GetVirtualPathTo(gitFileToTest);

            this.VerifyWorktreeBit(gitFileToTest, LsFilesStatus.SkipWorktree);

            ManualResetEventSlim resetEvent = GitHelpers.AcquireGSDLock(this.Enlistment, out _);

            this.fileSystem.WriteAllText(fileToCreate, "Anything can go here");
            this.fileSystem.FileExists(fileToCreate).ShouldEqual(true);
            resetEvent.Set();

            this.Enlistment.WaitForBackgroundOperations();

            GSDHelpers.ModifiedPathsShouldContain(this.Enlistment, this.fileSystem, gitFileToTest);
            this.VerifyWorktreeBit(gitFileToTest, LsFilesStatus.Cached);
        }