24#include <unordered_map>
48namespace fs = std::filesystem;
130 std::unordered_map<std::string, Remote> remotes_;
139 fs::path config_path_;
174 bool addRemote(
const std::string& name,
const std::string& url);
200 bool hasRemote(
const std::string& name)
const;
213 std::string
getRemoteUrl(
const std::string& name)
const;
261 size_t count()
const {
return remotes_.size(); }
void save() const
Saves the current remote configurations back to the config file.
Definition RemoteManager.cxx:75
RemoteManager(const fs::path &repo_path)
Constructs a RemoteManager and loads existing remotes.
Definition RemoteManager.cxx:25
bool hasRemote(const std::string &name) const
Checks if a remote with the given name exists.
Definition RemoteManager.cxx:55
std::string getRemoteUrl(const std::string &name) const
Gets the URL of a configured remote.
Definition RemoteManager.cxx:59
std::vector< std::string > listRemotes() const
Lists the names of all configured remotes.
Definition RemoteManager.cxx:67
void load()
Loads (or reloads) the remote configurations from the config file.
Definition RemoteManager.cxx:89
size_t count() const
Gets the number of configured remotes.
Definition RemoteManager.hxx:166
bool removeRemote(const std::string &name)
Removes a remote configuration by name.
Definition RemoteManager.cxx:44
bool addRemote(const std::string &name, const std::string &url)
Adds a new remote configuration.
Definition RemoteManager.cxx:30
Server-side components and administration commands.
Remote(const std::string &name, const std::string &url)
Constructs a Remote struct.
Definition RemoteManager.hxx:67
std::string name
The shortname of the remote (e.g., "origin").
Definition RemoteManager.hxx:47
std::string url
The URL (path or network address) of the remote.
Definition RemoteManager.hxx:53
std::string fetch_spec
The refspec defining what to fetch (e.g., "+refs/heads/*:refs/remotes/origin/*").
Definition RemoteManager.hxx:59