Example #1
0
        public ActionResult Index(
            string path)
        {
            var repository = new GitVersioningSystem(path);

            var model = new RepositoryViewModel {
                RepositoryPath = repository.RootPath,
                Branches       = repository.GetBranches(),
                ReadMe         = repository.FindAndReadFile(_isReadMe)
            };

            return(View(model));
        }
Example #2
0
        private void GetRepositories(
            ICollection <OrganizationRepository> directories,
            DirectoryInfo directory,
            string relativePath)
        {
            if (directory.Name.EndsWith(".git"))
            {
                // Repository
                var repository = new GitVersioningSystem(relativePath);

                directories.Add(
                    new OrganizationRepository
                {
                    Name        = repository.RootPath,
                    HasBranches = repository.GetBranches().Any()
                });
            }
            else
            {
                // Namespace
                foreach (var subDirectory in directory.EnumerateDirectories())
                {
                    try
                    {
                        subDirectory.EnumerateDirectories();
                    }
                    catch (UnauthorizedAccessException)
                    {
                        continue;
                    }

                    var path = string.Concat(relativePath, "/", subDirectory.Name);
                    GetRepositories(directories, subDirectory, path);
                }
            }
        }