Show branch starts in commit history
This commit is contained in:
@@ -180,6 +180,7 @@ pub struct CommitRow {
|
||||
pub sha: String,
|
||||
pub title: String,
|
||||
pub detail: String,
|
||||
pub branch_label: Option<String>,
|
||||
pub top_lanes: Vec<u32>,
|
||||
pub bottom_lanes: Vec<u32>,
|
||||
pub node_lane: Option<u32>,
|
||||
@@ -516,6 +517,12 @@ pub fn commit_page(
|
||||
.and_then(|commit| commit.author.as_ref())
|
||||
.and_then(|author| author.date.as_deref())
|
||||
.or(commit.created.as_deref());
|
||||
let mut branch_labels = row.refs.clone();
|
||||
for label in &row.branch_starts {
|
||||
if !branch_labels.contains(label) {
|
||||
branch_labels.push(label.clone());
|
||||
}
|
||||
}
|
||||
Some(CommitRow {
|
||||
sha: sha.into(),
|
||||
title: details
|
||||
@@ -523,16 +530,12 @@ pub fn commit_page(
|
||||
.map(|message| message.lines().next().unwrap_or(message))
|
||||
.unwrap_or("Commit")
|
||||
.into(),
|
||||
detail: if row.refs.is_empty() {
|
||||
format!("{author} · {}\n{}", compact_date(date), short_sha(sha))
|
||||
detail: if !branch_labels.is_empty() {
|
||||
format!("{author} · {} · {}", compact_date(date), short_sha(sha))
|
||||
} else {
|
||||
format!(
|
||||
"{}\n{author} · {} · {}",
|
||||
row.refs.join(" · "),
|
||||
compact_date(date),
|
||||
short_sha(sha)
|
||||
)
|
||||
format!("{author} · {}\n{}", compact_date(date), short_sha(sha))
|
||||
},
|
||||
branch_label: (!branch_labels.is_empty()).then(|| branch_labels.join(" · ")),
|
||||
top_lanes: indices(&row.top_lanes),
|
||||
bottom_lanes: indices(&row.bottom_lanes),
|
||||
node_lane: row.node_lane.map(|lane| lane as u32),
|
||||
|
||||
Reference in New Issue
Block a user