mirror of
https://codeberg.org/Cyborus/forgejo-cli.git
synced 2024-11-27 12:03:49 +01:00
enumerate remotes before checking remote tracking branch
This commit is contained in:
parent
8465a4a857
commit
3dec5f9ebe
1 changed files with 15 additions and 15 deletions
30
src/repo.rs
30
src/repo.rs
|
@ -127,21 +127,6 @@ impl RepoInfo {
|
|||
}
|
||||
}
|
||||
|
||||
// if the current branch is tracking a remote branch, use that remote
|
||||
if name.is_none() {
|
||||
let head = local_repo.head()?;
|
||||
let branch_name = head.name().ok_or_else(|| eyre!("branch name not UTF-8"))?;
|
||||
tmp = local_repo.branch_upstream_remote(branch_name).ok();
|
||||
name = tmp
|
||||
.as_ref()
|
||||
.map(|remote| {
|
||||
remote
|
||||
.as_str()
|
||||
.ok_or_else(|| eyre!("remote name not UTF-8"))
|
||||
})
|
||||
.transpose()?;
|
||||
}
|
||||
|
||||
// if there's a remote whose host url matches the one
|
||||
// specified with `--host`, use that
|
||||
//
|
||||
|
@ -169,6 +154,21 @@ impl RepoInfo {
|
|||
}
|
||||
}
|
||||
|
||||
// if the current branch is tracking a remote branch, use that remote
|
||||
if name.is_none() {
|
||||
let head = local_repo.head()?;
|
||||
let branch_name = head.name().ok_or_else(|| eyre!("branch name not UTF-8"))?;
|
||||
tmp = local_repo.branch_upstream_remote(branch_name).ok();
|
||||
name = tmp
|
||||
.as_ref()
|
||||
.map(|remote| {
|
||||
remote
|
||||
.as_str()
|
||||
.ok_or_else(|| eyre!("remote name not UTF-8"))
|
||||
})
|
||||
.transpose()?;
|
||||
}
|
||||
|
||||
if let Some(name) = name {
|
||||
if let Ok(remote) = local_repo.find_remote(name) {
|
||||
let url_s = std::str::from_utf8(remote.url_bytes())?;
|
||||
|
|
Loading…
Reference in a new issue