private void ParseEntries(IDictionary <string, GitObject> entries, Tree treeInfo, string commit) { var treesToDescend = new Queue <Tree>(new[] { treeInfo }); while (treesToDescend.Any()) { var currentTree = treesToDescend.Dequeue(); foreach (var item in currentTree) { if (item.TargetType == TreeEntryTargetType.Tree) { treesToDescend.Enqueue((Tree)item.Target); } var path = item.Path.Replace('\\', '/'); entries[path] = new GitObject { Mode = item.Mode, Sha = item.Target.Sha, ObjectType = item.TargetType, Path = path, Commit = commit }; } } }
private GitObject Lookup(string pathInGitRepo) { if (_initialTree.ContainsKey(pathInGitRepo)) return _initialTree[pathInGitRepo]; var fullPath = pathInGitRepo; var splitResult = SplitDirnameFilename.Match(pathInGitRepo); if (splitResult.Success) { var dirName = splitResult.Groups["dir"].Value; var fileName = splitResult.Groups["file"].Value; fullPath = Lookup(dirName).Path + "/" + fileName; } _initialTree[fullPath] = new GitObject { Path = fullPath }; return _initialTree[fullPath]; }
private GitObject Lookup(string pathInGitRepo) { GitObject result; if (_initialTree.TryGetValue(pathInGitRepo, out result)) return result; var fullPath = pathInGitRepo; var splitResult = SplitDirnameFilename.Match(pathInGitRepo); if (splitResult.Success) { var dirName = splitResult.Groups["dir"].Value; var fileName = splitResult.Groups["file"].Value; fullPath = Lookup(dirName).Path + "/" + fileName; } result = new GitObject { Path = fullPath }; _initialTree[fullPath] = result; return result; }
private string UpdateToMatchExtantCasing(string pathInGitRepo, IDictionary <string, GitObject> initialTree) { if (initialTree.ContainsKey(pathInGitRepo)) { return(initialTree[pathInGitRepo].Path); } var fullPath = pathInGitRepo; var splitResult = SplitDirnameFilename.Match(pathInGitRepo); if (splitResult.Success) { var dirName = splitResult.Groups["dir"].Value; var fileName = splitResult.Groups["file"].Value; fullPath = UpdateToMatchExtantCasing(dirName, initialTree) + "/" + fileName; } initialTree[fullPath] = new GitObject { Path = fullPath }; return(fullPath); }
private void ParseEntries(IDictionary<string, GitObject> entries, Tree treeInfo, string commit) { var treesToDescend = new Queue<Tree>(new[] {treeInfo}); while (treesToDescend.Any()) { var currentTree = treesToDescend.Dequeue(); foreach (var item in currentTree) { if (item.TargetType == TreeEntryTargetType.Tree) { treesToDescend.Enqueue((Tree)item.Target); } var path = item.Path.Replace('\\', '/'); entries[path] = new GitObject { Mode = item.Mode, Sha = item.Target.Sha, ObjectType = item.TargetType, Path = path, Commit = commit }; } } }
private string UpdateToMatchExtantCasing(string pathInGitRepo, IDictionary<string, GitObject> initialTree) { if (initialTree.ContainsKey(pathInGitRepo)) return initialTree[pathInGitRepo].Path; var fullPath = pathInGitRepo; var splitResult = SplitDirnameFilename.Match(pathInGitRepo); if (splitResult.Success) { var dirName = splitResult.Groups["dir"].Value; var fileName = splitResult.Groups["file"].Value; fullPath = UpdateToMatchExtantCasing(dirName, initialTree) + "/" + fileName; } initialTree[fullPath] = new GitObject { Path = fullPath }; return fullPath; }
private string UpdateToMatchExtantCasing_NEW(string pathInGitRepo, IDictionary<string, GitObject> initialTree) { if (initialTree.ContainsKey(pathInGitRepo)) return initialTree[pathInGitRepo].Path; var fullPath = pathInGitRepo; var pathWithDirMatch = pathWithDirRegex.Match(pathInGitRepo); if (pathWithDirMatch.Success) { var dirName = pathWithDirMatch.Groups["dir"].Value; var fileName = pathWithDirMatch.Groups["file"].Value; fullPath = UpdateToMatchExtantCasing_NEW(dirName, initialTree) + "/" + fileName; } initialTree[fullPath] = new GitObject {Path = fullPath}; return fullPath; }