Skip to content

Commit 33f7f47

Browse files
committed
Only display master commits and commits at the selected bounds in index graphs
1 parent 08edad6 commit 33f7f47

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

site/src/request_handlers/graph.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use collector::Bound;
2+
use database::CommitType;
23
use std::collections::HashMap;
34
use std::sync::Arc;
45

@@ -140,9 +141,19 @@ async fn create_graphs(
140141
}))
141142
}
142143

144+
/// Returns artifact IDs for the given range.
145+
/// Inside of the range (not at the start/end), only master commits are kept.
143146
fn artifact_ids_for_range(ctxt: &SiteCtxt, start: Bound, end: Bound) -> Vec<ArtifactId> {
144147
let range = ctxt.data_range(start..=end);
145-
range.into_iter().map(|c| c.into()).collect()
148+
let count = range.len();
149+
range
150+
.into_iter()
151+
.enumerate()
152+
.filter(|(index, commit)| {
153+
*index == 0 || *index == count - 1 || matches!(commit.r#type, CommitType::Master)
154+
})
155+
.map(|c| c.1.into())
156+
.collect()
146157
}
147158

148159
/// Creates a summary "benchmark" that averages the results of all other

0 commit comments

Comments
 (0)