Example #1
0
        private static void AddTreeNode(DirectoryNode root, string workingDirectory, GitIgnore.Matcher matcherOpt)
        {
            var segments = PathUtilities.Split(workingDirectory);

            var node = root;

            for (int i = 0; i < segments.Length; i++)
            {
                int index = node.FindChildIndex(segments[i]);
                if (index >= 0)
                {
                    node = node.OrderedChildren[index];
                }
                else
                {
                    var newNode = new DirectoryNode(segments[i]);
                    node.OrderedChildren.Insert(~index, newNode);
                    node = newNode;
                }

                if (i == segments.Length - 1)
                {
                    node.SetMatcher(workingDirectory, matcherOpt);
                }
            }
        }
Example #2
0
 public GitIgnore.Matcher GetMatcher(Func <string, GitRepository> repositoryFactory)
 => _lazyMatcher ?? (_lazyMatcher = repositoryFactory(WorkingDirectoryFullPath).Ignore.CreateMatcher());
Example #3
0
 public void SetMatcher(string workingDirectory, GitIgnore.Matcher matcher)
 {
     WorkingDirectoryFullPath = workingDirectory;
     _lazyMatcher             = matcher;
 }