#pragma once #include #include #include // Discovers git repositories that are direct children of a root directory and // keeps an immutable name -> absolute path mapping. The name (directory name) // is the public identifier used in URLs. class RepoScanner { public: explicit RepoScanner(std::string root); // Repository names sorted alphabetically. std::vector names() const; // Absolute path for a repository, or "" if the name is unknown. std::string path_for(const std::string &name) const; const std::string &root() const { return root_; } private: std::string root_; std::map repos_; // name -> path };