Skip to content

Commit

Permalink
Fix make-tidy lock file checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Diggsey committed Aug 13, 2016
1 parent 7341d68 commit b3908d0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/tools/tidy/src/cargo_lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

use std::path::Path;
use std::ffi::OsStr;

const CARGO_LOCK: &'static str = "Cargo.lock";

Expand All @@ -18,14 +19,15 @@ pub fn check(path: &Path, bad: &mut bool) {
super::walk(path,
&mut |path| super::filter_dirs(path) || path.ends_with("src/test"),
&mut |file| {
let name = file.file_name().unwrap().to_string_lossy();
if name == CARGO_LOCK {
if let Some(CARGO_LOCK) = file.file_name().and_then(OsStr::to_str) {
let rel_path = file.strip_prefix(path).unwrap();
let git_friendly_path = rel_path.to_str().unwrap().replace("\\", "/");
let ret_code = Command::new("git")
.arg("diff-index")
.arg("--quiet")
.arg("diff")
.arg("--exit-code")
.arg("--patch")
.arg("HEAD")
.arg(rel_path)
.arg(&git_friendly_path)
.current_dir(path)
.status()
.unwrap_or_else(|e| {
Expand Down

0 comments on commit b3908d0

Please sign in to comment.