mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-10-05 16:37:44 +03:00
🔧 fix: update condition for getting remote based on credentials and remote URL
The condition for getting the remote based on credentials and remote URL has been updated. Previously, it only checked if credentials had a GitHub token. Now, it also checks if the remote URL is a GitHub URL. This ensures that the correct remote is retrieved based on the credentials and the remote URL.
This commit is contained in:
parent
d0e391ab82
commit
ce5c0e36d5
@ -277,7 +277,18 @@ impl Repository {
|
||||
name: &str,
|
||||
credentials: &git::credentials::Factory,
|
||||
) -> Result<git::Remote, RemoteError> {
|
||||
if credentials.has_github_token() {
|
||||
let remote = self
|
||||
.git_repository
|
||||
.find_remote(name)
|
||||
.context("failed to find remote")
|
||||
.map_err(RemoteError::Other)?;
|
||||
|
||||
let is_github = remote
|
||||
.url()
|
||||
.map(|url| url.map_or(false, |url| url.is_github()))
|
||||
.unwrap_or(false);
|
||||
|
||||
if credentials.has_github_token() && is_github {
|
||||
self.get_https_remote(name)
|
||||
} else {
|
||||
self.get_ssh_remote(name)
|
||||
|
Loading…
Reference in New Issue
Block a user