Allow non-origin main branches to be listed

This commit is contained in:
Caleb Owens 2024-05-24 15:22:34 +02:00
parent 27f3b65b79
commit 571f16b8b2
2 changed files with 7 additions and 3 deletions

View File

@ -3,7 +3,6 @@ use super::{
TreeBuilder, Url,
};
use crate::path::Normalize;
use git2::string_array::StringArray;
use git2::{BlameOptions, Submodule};
use git2_hooks::HookResult;
#[cfg(unix)]
@ -12,7 +11,6 @@ use std::os::unix::fs::PermissionsExt;
use std::os::windows::process::CommandExt;
use std::process::Stdio;
use std::{io::Write, path::Path, str};
use tokio::sync::Mutex;
// wrapper around git2::Repository to get control over how it's used.
pub struct Repository(git2::Repository);

View File

@ -65,8 +65,14 @@ pub fn list_remote_branches(
.flatten()
{
let branch = branch_to_remote_branch(&branch)?;
if let Some(branch) = branch {
if branch.name.branch() != Some(default_target.branch.branch())
let upstream_remote = branch.upstream.as_ref().map(|u| u.remote());
let branch_is_trunk = branch.name.branch() == Some(default_target.branch.branch())
&& upstream_remote == Some(default_target.branch.remote());
if !branch_is_trunk
&& branch.name.branch() != Some("gitbutler/integration")
&& branch.name.branch() != Some("gitbutler/target")
{