Skip to content

Commit

Permalink
split on whitespace and check if 2nd index is ->
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cole-h committed May 26, 2020
1 parent 368ce7b commit a1c7a04
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions ofborg/src/tasks/eval/nixpkgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,20 @@ impl<'a> NixpkgsStrategy<'a> {
}

/// Takes a list of commit messages and checks if any of them contains the
/// standard version bump indicator, `->`; if any do, the `8.has: package
/// (update)` label is added.
fn tag_from_commits(&self, msgs: &[String]) {
for msg in msgs {
if msg.contains("->") {
/// standard version bump indicator, `->`, at the second index after
/// splitting on whitespace; if any do, the `8.has: package (update)` label
/// is added.
///
/// * `attr: 1.0.0 -> 1.1.0` will get the label
/// * `attr: move from fetchTarball -> fetchFromGitHub` will not get the
/// label
fn tag_from_commits(&self, messages: &[String]) {
for message in messages {
let msg: Vec<&str> = message.split(char::is_whitespace).collect();

// attr: 1.0.0 -> 1.1.0
// 0 1 2 3
if msg.get(2) == Some(&"->") {
update_labels(
&self.issue_ref,
&[String::from("8.has: package (update)")],
Expand Down

0 comments on commit a1c7a04

Please sign in to comment.