lint_repo_hygiene.rs raw

   1  // Copyright (c) The Bitcoin Core developers
   2  // Distributed under the MIT software license, see the accompanying
   3  // file COPYING or https://opensource.org/license/mit/.
   4  
   5  use std::process::Command;
   6  
   7  use crate::util::{commit_range, get_subtrees, LintResult};
   8  
   9  pub fn lint_subtree() -> LintResult {
  10      // This only checks that the trees are pure subtrees, it is not doing a full
  11      // check with -r to not have to fetch all the remotes.
  12      let mut good = true;
  13      for subtree in get_subtrees() {
  14          good &= Command::new("test/lint/git-subtree-check.sh")
  15              .arg(subtree)
  16              .status()
  17              .expect("command_error")
  18              .success();
  19      }
  20      if good {
  21          Ok(())
  22      } else {
  23          Err("".to_string())
  24      }
  25  }
  26  
  27  pub fn lint_scripted_diff() -> LintResult {
  28      if Command::new("test/lint/commit-script-check.sh")
  29          .arg(commit_range())
  30          .status()
  31          .expect("command error")
  32          .success()
  33      {
  34          Ok(())
  35      } else {
  36          Err("".to_string())
  37      }
  38  }
  39