binocular/preview/request/git/
branch.rs1use super::ansi::parse_ansi_text;
2use crate::preview::PreviewContent;
3use crate::search::sources::git::read_branch_preview;
4use ratatui::text::Text;
5
6pub(crate) fn build_git_branch_preview(repo_root: &str, branch: &str) -> PreviewContent {
7 match read_branch_preview(std::path::Path::new(repo_root), branch) {
8 Ok(text) => PreviewContent::PlainText(parse_ansi_text(text)),
9 Err(err) => {
10 PreviewContent::PlainText(Text::from(format!("Failed to load branch preview: {err}")))
11 }
12 }
13}