private RepositoryFileReference[] ParseTreeFile() { return(Directory .ReadTextFile(treeFilePath) .SplitInLines() .Select(line => { var parts = line.SplitBySpace(3); return new RepositoryFileReference { BlobSha = parts[0], Size = long.Parse(parts[1]), Path = parts[2] }; }) .ToArray()); }
private LocalRepository(string directoryPath, bool allowNonLinkedDirectory = false) { var directory = new FilesystemDirectory(directoryPath); directoryPath = directory.PhysicalPath; var isLinked = MoveDirectoryUpUntilRepositoryRoot(directory); if (isLinked) { this.FullRepositoryName = directory.ReadTextFile(stateFilePath).SplitInLines()[0]; } else if (allowNonLinkedDirectory) { this.FullRepositoryName = null; directory = new FilesystemDirectory(directoryPath); } else { throw new InvalidOperationException($"{directoryPath} is not linked to any remote repository"); } this.Directory = directory; }