mirror of
https://codeberg.org/Cyborus/forgejo-cli.git
synced 2024-11-23 18:31:46 +01:00
don't look for remote if it obviously won't be there
This commit is contained in:
parent
337c575815
commit
8b6a5a6c13
1 changed files with 7 additions and 11 deletions
12
src/repo.rs
12
src/repo.rs
|
@ -118,19 +118,15 @@ impl RepoCommand {
|
||||||
host.join(&format!("{}/{}", login.username(), repo))?
|
host.join(&format!("{}/{}", login.username(), repo))?
|
||||||
);
|
);
|
||||||
|
|
||||||
let upstream = set_upstream.as_deref().unwrap_or("origin");
|
if set_upstream.is_some() || push {
|
||||||
|
|
||||||
let repo = git2::Repository::open(".")?;
|
let repo = git2::Repository::open(".")?;
|
||||||
let mut remote = if set_upstream.is_some() || push {
|
let upstream = set_upstream.as_deref().unwrap_or("origin");
|
||||||
repo.remote(upstream, new_repo.clone_url.as_str())?
|
let mut remote = repo.remote(upstream, new_repo.clone_url.as_str())?;
|
||||||
} else {
|
|
||||||
repo.find_remote(upstream)?
|
|
||||||
};
|
|
||||||
|
|
||||||
if push {
|
if push {
|
||||||
remote.push::<&str>(&[], None)?;
|
remote.push::<&str>(&[], None)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
RepoCommand::Info => {
|
RepoCommand::Info => {
|
||||||
let repo = RepoInfo::get_current()?;
|
let repo = RepoInfo::get_current()?;
|
||||||
let api = keys.get_api(&repo.host_url())?;
|
let api = keys.get_api(&repo.host_url())?;
|
||||||
|
|
Loading…
Reference in a new issue