Exemplo n.º 1
0
        public void IgnoreScatteredDotDir()
        {
            var working = FileService.CreateTempDirectory ();

            var path = Path.Combine (working, "test");
            var staleGit = Path.Combine (working, ".git");
            var staleSvn = Path.Combine (working, ".svn");
            Directory.CreateDirectory (path);
            Directory.CreateDirectory (staleGit);
            Directory.CreateDirectory (staleSvn);

            Assert.IsNull (VersionControlService.GetRepositoryReference ((path).TrimEnd (Path.DirectorySeparatorChar), null));

            DeleteDirectory (working);
        }
Exemplo n.º 2
0
        // Tests VersionControlService.GetRepositoryReference.
        public async Task RightRepositoryDetection()
        {
            var path = ((string)LocalPath).TrimEnd(Path.DirectorySeparatorChar);
            var repo = VersionControlService.GetRepositoryReference(path, null);

            Assert.That(repo, IsCorrectType(), "#1");

            while (!String.IsNullOrEmpty(path))
            {
                path = Path.GetDirectoryName(path);
                if (path == null)
                {
                    return;
                }
                Assert.IsNull(VersionControlService.GetRepositoryReference(path, null), "#2." + path);
            }

            // Versioned file
            await AddFileAsync("foo", "contents", true, true);

            path = Path.Combine(LocalPath, "foo");
            Assert.AreSame(VersionControlService.GetRepositoryReference(path, null), repo, "#2");

            // Versioned directory
            await AddDirectoryAsync("bar", true, true);

            path = Path.Combine(LocalPath, "bar");
            Assert.AreSame(VersionControlService.GetRepositoryReference(path, null), repo, "#3");

            // Unversioned file
            await AddFileAsync("bip", "contents", false, false);

            Assert.AreSame(VersionControlService.GetRepositoryReference(path, null), repo, "#4");

            // Unversioned directory
            await AddDirectoryAsync("bop", false, false);

            Assert.AreSame(VersionControlService.GetRepositoryReference(path, null), repo, "#5");

            // Nonexistent file
            path = Path.Combine(LocalPath, "do_i_exist");
            Assert.AreSame(VersionControlService.GetRepositoryReference(path, null), repo, "#6");

            // Nonexistent directory
            path = Path.Combine(LocalPath, "do", "i", "exist");
            Assert.AreSame(VersionControlService.GetRepositoryReference(path, null), repo, "#6");
        }