pub struct Remote;Expand description
Remote management — list, add, rename, remove, set-url, prune.
The peer of crate::Branch and crate::Stash: a thin, typed
wrapper over the git CLI. Fetch / pull / push are not here — those
are long-running network operations owned by lattice-magit’s
RemoteOp, which runs them detached. Everything on this type is a
local config edit that returns immediately.
Implementations§
Source§impl Remote
impl Remote
Sourcepub fn list(repo: &Repository) -> Result<Vec<RemoteEntry>>
pub fn list(repo: &Repository) -> Result<Vec<RemoteEntry>>
List every configured remote with its fetch and push URLs.
Equivalent to git remote -v.
Sourcepub fn add(repo: &Repository, name: &str, url: &str) -> Result<()>
pub fn add(repo: &Repository, name: &str, url: &str) -> Result<()>
Add a new remote.
Equivalent to git remote add <name> <url>. Does not fetch.
Sourcepub fn rename(repo: &Repository, old: &str, new: &str) -> Result<()>
pub fn rename(repo: &Repository, old: &str, new: &str) -> Result<()>
Rename a remote, rewriting its tracking refspecs.
Equivalent to git remote rename <old> <new>.
Sourcepub fn remove(repo: &Repository, name: &str) -> Result<()>
pub fn remove(repo: &Repository, name: &str) -> Result<()>
Remove a remote and its remote-tracking branches.
Equivalent to git remote remove <name>.
Sourcepub fn set_url(repo: &Repository, name: &str, url: &str) -> Result<()>
pub fn set_url(repo: &Repository, name: &str, url: &str) -> Result<()>
Point a remote at a different URL.
Equivalent to git remote set-url <name> <url>. This sets the
fetch URL; a remote with a separately-configured pushurl keeps
it, which is why RemoteEntry carries both.