Beispiel #1
0
        private void ProcessDirectories(string currentDir, ref Stack <string> dirs)
        {
            if (!GetDirectories(currentDir, out var subDirs))
            {
                return;
            }

            // check git repository
            if (subDirs.Contains(Path.Combine(currentDir, ".git")))
            {
                var gitStatus = ExecuteCommandLine(currentDir, "git", "status -s");
                if (!string.IsNullOrEmpty(gitStatus))
                {
                    _logger.LogWarning($"Directory \"{currentDir}\" has uncommitted changes");
                    _logger.LogDebug(gitStatus);
                }
                var gitRemoteOriginUrl = ExecuteCommandLine(currentDir, "git", "remote get-url origin")
                                         .Replace("\t", "")
                                         .Replace("\n", "")
                                         .Trim();
                _reporter.StartFolder(currentDir, gitRemoteOriginUrl, !string.IsNullOrEmpty(gitStatus));
                _reporter.EndFolder();
                return;
            }

            foreach (var str in subDirs)
            {
                dirs.Push(str);
            }

            _reporter.StartFolder(currentDir);

            ProcessFiles(currentDir);

            _reporter.EndFolder();
        }