[wip] support multiple remotes

This commit is contained in:
extrawurst 2023-02-11 11:12:28 +00:00
parent 9782eb7b1f
commit d846174c38
3 changed files with 12 additions and 2 deletions

View file

@ -71,8 +71,8 @@ pub use merge::{
};
pub use rebase::rebase_branch;
pub use remotes::{
get_default_remote, get_remotes, push::AsyncProgress,
tags::PushTagsProgress,
get_default_remote, get_remotes, has_default_remote,
push::AsyncProgress, tags::PushTagsProgress,
};
pub(crate) use repository::repo;
pub use repository::{RepoPath, RepoPathRef};

View file

@ -85,6 +85,14 @@ pub(crate) fn get_default_remote_in_repo(
Err(Error::NoDefaultRemoteFound)
}
/// returns true based on result of `get_default_remote_in_repo` being anything but `NoDefaultRemoteFound`
pub fn has_default_remote(repo: &Repository) -> bool {
!matches!(
get_default_remote_in_repo(repo),
Err(Error::NoDefaultRemoteFound)
)
}
///
fn fetch_from_remote(
repo_path: &RepoPath,

View file

@ -109,6 +109,8 @@ impl PushComponent {
(false, false) => PushComponentModifier::None,
};
//TODO: check if branch is tracked on a remote or if we find a default remote if not go into a remote selection popup
self.show()?;
if need_username_password(&self.repo.borrow())? {