GitScc.GitRepository.GetCurrentChangedFiles C# (CSharp) Method

GetCurrentChangedFiles() private method

private GetCurrentChangedFiles ( bool retryAllowed = true, Repository repository = null ) : GitFile>.Dictionary
retryAllowed bool
repository LibGit2Sharp.Repository
return GitFile>.Dictionary
        private Dictionary<string, GitFile> GetCurrentChangedFiles(bool retryAllowed = true, Repository repository = null)
        {
            //var files = new List<GitFile>();
            var files = new Dictionary<string, GitFile>();
            //Repository repository = null;
            try
            {
                //let a function 
                if (repository == null)
                {
                    repository = _statusRepository;
                }
                var repoFiles = repository.RetrieveStatus(new StatusOptions()
                {
                    IncludeUnaltered = false,
                    RecurseIgnoredDirs = false
                });

                files = repoFiles.Where(item => IsChangedStatus(item.State) && !(FileIgnored(item.FilePath)))
                    .Select(item => new GitFile(repository, item)).ToDictionary(x=>x.FilePath,x =>x); //);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error In GetCurrentChangedFiles: " + ex.Message);
                Thread.Sleep(2000);
                _statusRepository?.Dispose();
                _statusRepository = GetRepository();
            }
            return files;
        }