public void HonorsTopLevelIgnore()
        {
            WriteIgnore(".", "*.o");
            _handler = new IgnoreHandler(db);

            Assert.IsTrue(_handler.IsIgnored("test.o"));
        }
        public void HonorsConfigExcludes()
        {
            WriteConfigExcludes("ignoreHandler", "*.a");
            _handler = new IgnoreHandler(db);

            Assert.IsTrue(_handler.IsIgnored("test.a"));
        }
        public void HonorsExcludeFile()
        {
            WriteExclude("*.html");
            _handler = new IgnoreHandler(db);

            Assert.IsTrue(_handler.IsIgnored("test.html"));
        }
Exemple #4
0
		public void TestNegated()
		{
			WriteIgnore(".", "*.o");
			WriteIgnore("test", "!*.o");
			_handler = new IgnoreHandler(db);

			Assert.IsFalse(_handler.IsIgnored("test/test.o"));
		}
        public void MultipleIgnoreFiles()
        {
            WriteIgnore(".", "*.o");
            WriteIgnore("./foo/bar", "baz");
            _handler = new IgnoreHandler(db);

            Assert.IsTrue(_handler.IsIgnored("test.o"));
            Assert.IsTrue(_handler.IsIgnored("a/file/somewhere/down/the/hierarchy/test.o"));
            Assert.IsTrue(_handler.IsIgnored("foo/bar/down/the/hierarchy/baz"));
            Assert.IsTrue(_handler.IsIgnored("foo/bar/baz"));
            Assert.IsFalse(_handler.IsIgnored("baz"));
            Assert.IsFalse(_handler.IsIgnored("a/file/somewhere/down/the/hierarchy/baz"));
        }
        public void PatternsWithPathComponent()
        {
            WriteIgnore(".", "foo/bar/*.o"); // <--- should ignore all o files only in foo/bar
            _handler = new IgnoreHandler(db);

            Assert.IsFalse(_handler.IsIgnored("test.o"));
            Assert.IsFalse(_handler.IsIgnored("a/file/somewhere/down/the/hierarchy/test.o"));
            Assert.IsTrue(_handler.IsIgnored("foo/bar/down/the/hierarchy/test.o"));
            Assert.IsTrue(_handler.IsIgnored("foo/bar/baz.o"));
        }
Exemple #7
0
        /// <summary>
        /// Recalculates the status
        /// </summary>
        public void Update()
        {
            AnyDifferences = false;
            Added = new HashSet<string>();
            Staged = new HashSet<string>();
            Removed = new HashSet<string>();
            Missing = new HashSet<string>();
            Modified = new HashSet<string>();
            Untracked = new HashSet<string>();
            MergeConflict = new HashSet<string>();
            IgnoreHandler = new IgnoreHandler(Repository);

            if (_file_path != null)
                UpdateSingleFile (_file_path);
            else if (_recursive)
                UpdateDirectoryRecursive (_root_path);
            else
                UpdateDirectoryNotRecursive (_root_path);
        }
Exemple #8
0
 internal RepositoryStatus(Repository repository, RepositoryStatusOptions options, string singleFile, string rootDir, bool recursive)
 {
     Repository = repository;
     Options = options ?? new RepositoryStatusOptions { ForceContentCheck = true };
     IgnoreHandler = new IgnoreHandler(Repository);
     _root_path = Repository.ToGitPath (rootDir);
     _recursive = recursive;
     _file_path = Repository.ToGitPath (singleFile);
     Update();
 }
Exemple #9
0
 private GitSharp.Core.Tree CreateWorkingDirectoryTree(Repository repo)
 {
     var root = repo._internal_repo.WorkingDirectory;
     var tree = new Core.Tree(repo._internal_repo);
     IgnoreHandler = new IgnoreHandler(repo);
     FillTree(root, tree);
     return tree;
 }