mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-03 15:33:13 +03:00
Merge pull request #1421 from gitbutlerapp/handle-upstream-branch-not-found
🔨 chore: improve error handling when finding upstream branch for list…
This commit is contained in:
commit
0fe5f109c3
@ -654,11 +654,20 @@ pub fn list_virtual_branches(
|
||||
|
||||
let repo = &project_repository.git_repository;
|
||||
|
||||
let upstream_branch = branch
|
||||
let upstream_branch = match branch
|
||||
.upstream
|
||||
.as_ref()
|
||||
.map(|name| repo.find_branch(&git::BranchName::from(name.clone())))
|
||||
.transpose()?;
|
||||
.transpose()
|
||||
{
|
||||
Err(git::Error::NotFound(_)) => Ok(None),
|
||||
Err(error) => Err(error),
|
||||
Ok(branch) => Ok(branch),
|
||||
}
|
||||
.context(format!(
|
||||
"failed to find upstream branch for {}",
|
||||
branch.name
|
||||
))?;
|
||||
|
||||
let upstram_branch_commit = upstream_branch
|
||||
.as_ref()
|
||||
|
Loading…
Reference in New Issue
Block a user