Skip to content

Commit b3908d0

Browse files
committed
Fix make-tidy lock file checks
1 parent 7341d68 commit b3908d0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/tools/tidy/src/cargo_lock.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
use std::path::Path;
12+
use std::ffi::OsStr;
1213

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

@@ -18,14 +19,15 @@ pub fn check(path: &Path, bad: &mut bool) {
1819
super::walk(path,
1920
&mut |path| super::filter_dirs(path) || path.ends_with("src/test"),
2021
&mut |file| {
21-
let name = file.file_name().unwrap().to_string_lossy();
22-
if name == CARGO_LOCK {
22+
if let Some(CARGO_LOCK) = file.file_name().and_then(OsStr::to_str) {
2323
let rel_path = file.strip_prefix(path).unwrap();
24+
let git_friendly_path = rel_path.to_str().unwrap().replace("\\", "/");
2425
let ret_code = Command::new("git")
25-
.arg("diff-index")
26-
.arg("--quiet")
26+
.arg("diff")
27+
.arg("--exit-code")
28+
.arg("--patch")
2729
.arg("HEAD")
28-
.arg(rel_path)
30+
.arg(&git_friendly_path)
2931
.current_dir(path)
3032
.status()
3133
.unwrap_or_else(|e| {

0 commit comments

Comments
 (0)