Skip to content

Commit a1c7a04

Browse files
committed
split on whitespace and check if 2nd index is ->
This is slightly more robust than just checking if `->` exists anywhere in the title -- now, `attr: move from fetchTarball -> fetchFromGitHub` won't trigger the addition of the label.
1 parent 368ce7b commit a1c7a04

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

ofborg/src/tasks/eval/nixpkgs.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,20 @@ impl<'a> NixpkgsStrategy<'a> {
102102
}
103103

104104
/// Takes a list of commit messages and checks if any of them contains the
105-
/// standard version bump indicator, `->`; if any do, the `8.has: package
106-
/// (update)` label is added.
107-
fn tag_from_commits(&self, msgs: &[String]) {
108-
for msg in msgs {
109-
if msg.contains("->") {
105+
/// standard version bump indicator, `->`, at the second index after
106+
/// splitting on whitespace; if any do, the `8.has: package (update)` label
107+
/// is added.
108+
///
109+
/// * `attr: 1.0.0 -> 1.1.0` will get the label
110+
/// * `attr: move from fetchTarball -> fetchFromGitHub` will not get the
111+
/// label
112+
fn tag_from_commits(&self, messages: &[String]) {
113+
for message in messages {
114+
let msg: Vec<&str> = message.split(char::is_whitespace).collect();
115+
116+
// attr: 1.0.0 -> 1.1.0
117+
// 0 1 2 3
118+
if msg.get(2) == Some(&"->") {
110119
update_labels(
111120
&self.issue_ref,
112121
&[String::from("8.has: package (update)")],

0 commit comments

Comments
 (0)