Example #1
0
        void IGitStatusCache.RefreshWCRoot(GitItem gitItem)
        {
            if (gitItem == null)
            {
                throw new ArgumentNullException("svnItem");
            }

            Debug.Assert(gitItem.IsDirectory);

            // We retrieve nesting information by walking the entry data of the parent directory
            lock (_lock)
            {
                string root;

                try
                {
                    root = GetWorkingCopyRoot(gitItem.FullPath);
                }
                catch { root = null; }

                if (root == null)
                {
                    ((IGitItemUpdate)gitItem).SetState(GitItemState.None, GitItemState.IsWCRoot);
                    return;
                }

                // Set all nodes between this node and the root to not-a-wcroot
                IGitItemUpdate oi;
                while (root.Length < gitItem.FullPath.Length)
                {
                    oi = gitItem;

                    oi.SetState(GitItemState.None, GitItemState.IsWCRoot);
                    gitItem = gitItem.Parent;

                    if (gitItem == null)
                    {
                        return;
                    }
                }

                oi = gitItem;

                if (gitItem.FullPath == root)
                {
                    oi.SetState(GitItemState.IsWCRoot, GitItemState.None);
                }
                else
                {
                    oi.SetState(GitItemState.None, GitItemState.IsWCRoot);
                }
            }
        }