only local branches, scroll into view

This commit is contained in:
Scott Chacon 2023-03-13 13:00:29 +01:00
parent fb2a39b280
commit 6e0358baae
2 changed files with 12 additions and 2 deletions

View File

@ -1,6 +1,6 @@
use crate::{deltas, fs, projects, sessions, users};
use anyhow::{Context, Result};
use git2::{Cred, Signature};
use git2::{BranchType, Cred, Signature};
use std::{collections::HashMap, env, path::Path};
use tauri::regex::Regex;
use walkdir::WalkDir;
@ -158,7 +158,7 @@ impl Repository {
pub fn branches(&self) -> Result<Vec<String>> {
let mut branches = vec![];
for branch in self.git_repository.branches(None)? {
for branch in self.git_repository.branches(Some(BranchType::Local))? {
let (branch, _) = branch?;
branches.push(branch.name()?.unwrap().to_string());
}

View File

@ -119,6 +119,11 @@
} else {
items[items.length - 1].classList.add(...activeClass);
}
// scroll into view
const active2 = menu.querySelector('li.active');
if (active2) {
active2.scrollIntoView({ block: 'nearest' });
}
}
}
@ -136,6 +141,11 @@
} else {
items[0].classList.add(...activeClass);
}
// scroll into view
const active2 = menu.querySelector('li.active');
if (active2) {
active2.scrollIntoView({ block: 'nearest' });
}
}
}