dup current branch name in revlog

This commit is contained in:
extrawurst 2022-10-19 14:03:04 +02:00
parent 6dfe5ea62a
commit ac67e53b12
2 changed files with 1 additions and 19 deletions

View File

@ -32,7 +32,6 @@ const ELEMENTS_PER_LINE: usize = 9;
pub struct CommitList {
title: Box<str>,
selection: usize,
branch: Option<String>,
count_total: usize,
items: ItemBatch,
marked: Vec<(usize, CommitId)>,
@ -56,7 +55,6 @@ impl CommitList {
items: ItemBatch::default(),
marked: Vec::with_capacity(2),
selection: 0,
branch: None,
count_total: 0,
scroll_state: (Instant::now(), 0_f32),
tags: None,
@ -74,11 +72,6 @@ impl CommitList {
&mut self.items
}
///
pub fn set_branch(&mut self, name: Option<String>) {
self.branch = name;
}
///
pub const fn selection(&self) -> usize {
self.selection
@ -501,15 +494,11 @@ impl DrawableComponent for CommitList {
selection,
));
let branch_post_fix =
self.branch.as_ref().map(|b| format!("- {{{b}}}"));
let title = format!(
"{} {}/{} {}",
"{} {}/{}",
self.title,
self.count_total.saturating_sub(self.selection),
self.count_total,
branch_post_fix.as_deref().unwrap_or(""),
);
f.render_widget(

View File

@ -12,7 +12,6 @@ use crate::{
};
use anyhow::Result;
use asyncgit::{
cached,
sync::{self, get_branches_info, CommitId, RepoPathRef},
AsyncGitNotification, AsyncLog, AsyncTags, CommitFilesParams,
FetchStatus,
@ -38,7 +37,6 @@ pub struct Revlog {
git_tags: AsyncTags,
queue: Queue,
visible: bool,
branch_name: cached::BranchName,
key_config: SharedKeyConfig,
}
@ -73,7 +71,6 @@ impl Revlog {
),
git_tags: AsyncTags::new(repo.borrow().clone(), sender),
visible: false,
branch_name: cached::BranchName::new(repo.clone()),
key_config,
}
}
@ -103,10 +100,6 @@ impl Revlog {
self.git_tags.request(Duration::from_secs(3), false)?;
self.list.set_branch(
self.branch_name.lookup().map(Some).unwrap_or(None),
);
self.list.set_branches(get_branches_info(
&self.repo.borrow(),
true,