mirror of
https://codeberg.org/Cyborus/forgejo-cli.git
synced 2024-11-10 03:59:31 +01:00
Merge pull request 'don't look for remote if it obviously won't be there' (#4) from fix-find-remote into main
Reviewed-on: https://codeberg.org/Cyborus/forgejo-cli/pulls/4
This commit is contained in:
commit
e18ef78c9c
1 changed files with 7 additions and 11 deletions
18
src/repo.rs
18
src/repo.rs
|
@ -118,17 +118,13 @@ impl RepoCommand {
|
|||
host.join(&format!("{}/{}", login.username(), repo))?
|
||||
);
|
||||
|
||||
let upstream = set_upstream.as_deref().unwrap_or("origin");
|
||||
|
||||
let repo = git2::Repository::open(".")?;
|
||||
let mut remote = if set_upstream.is_some() || push {
|
||||
repo.remote(upstream, new_repo.clone_url.as_str())?
|
||||
} else {
|
||||
repo.find_remote(upstream)?
|
||||
};
|
||||
|
||||
if push {
|
||||
remote.push::<&str>(&[], None)?;
|
||||
if set_upstream.is_some() || push {
|
||||
let repo = git2::Repository::open(".")?;
|
||||
let upstream = set_upstream.as_deref().unwrap_or("origin");
|
||||
let mut remote = repo.remote(upstream, new_repo.clone_url.as_str())?;
|
||||
if push {
|
||||
remote.push::<&str>(&[], None)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
RepoCommand::Info => {
|
||||
|
|
Loading…
Reference in a new issue