diff --git a/CHANGELOG.md b/CHANGELOG.md index b94ec87d97..c42974d5b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * customizable `cmdbar_bg` theme color & screen spanning selected line bg [[@gigitsu](https://github.com/gigitsu)] ([#1299](https://github.com/extrawurst/gitui/pull/1299)) * use filewatcher instead of polling updates ([#1](https://github.com/extrawurst/gitui/issues/1)) * word motions to text input [[@Rodrigodd](https://github.com/Rodrigodd)] ([#1256](https://github.com/extrawurst/gitui/issues/1256)) +* file blame at right revision from commit-details [[@heiskane](https://github.com/heiskane)] ([#1122](https://github.com/extrawurst/gitui/issues/1122)) ### Fixes * remove insecure dependency `ansi_term` ([#1290](https://github.com/extrawurst/gitui/issues/1290)) diff --git a/src/components/commit_details/mod.rs b/src/components/commit_details/mod.rs index 02781271b9..db70e0f3e2 100644 --- a/src/components/commit_details/mod.rs +++ b/src/components/commit_details/mod.rs @@ -102,6 +102,8 @@ impl CommitDetailsComponent { self.commit = params; if let Some(id) = params { + self.file_tree.set_commit(Some(id.id)); + if let Some(other) = id.other { self.compare_details .set_commits(Some((id.id, other))); diff --git a/src/components/status_tree.rs b/src/components/status_tree.rs index c5ad55bd82..06a94120d8 100644 --- a/src/components/status_tree.rs +++ b/src/components/status_tree.rs @@ -14,7 +14,7 @@ use crate::{ ui::style::SharedTheme, }; use anyhow::Result; -use asyncgit::{hash, StatusItem, StatusItemType}; +use asyncgit::{hash, sync::CommitId, StatusItem, StatusItemType}; use crossterm::event::Event; use std::{borrow::Cow, cell::Cell, convert::From, path::Path}; use tui::{backend::Backend, layout::Rect, text::Span, Frame}; @@ -35,6 +35,7 @@ pub struct StatusTreeComponent { key_config: SharedKeyConfig, scroll_top: Cell, visible: bool, + revision: Option, } impl StatusTreeComponent { @@ -58,9 +59,14 @@ impl StatusTreeComponent { scroll_top: Cell::new(0), pending: true, visible: false, + revision: None, } } + pub fn set_commit(&mut self, revision: Option) { + self.revision = revision; + } + /// pub fn update(&mut self, list: &[StatusItem]) -> Result<()> { self.pending = false; @@ -428,7 +434,7 @@ impl Component for StatusTreeComponent { StackablePopupOpen::BlameFile( BlameFileOpen { file_path: status_item.path, - commit_id: None, + commit_id: self.revision, selection: None, }, ),