Check that executable file is in-tree before failing tidy check.
This commit is contained in:
parent
f883b0bbab
commit
be8df50c9f
@ -24,6 +24,7 @@ pub fn check(_path: &Path, _bad: &mut bool) {}
|
||||
#[cfg(unix)]
|
||||
pub fn check(path: &Path, bad: &mut bool) {
|
||||
use std::fs;
|
||||
use std::process::{Command, Stdio};
|
||||
use std::os::unix::prelude::*;
|
||||
|
||||
super::walk(path,
|
||||
@ -37,9 +38,23 @@ pub fn check(path: &Path, bad: &mut bool) {
|
||||
|
||||
let metadata = t!(fs::symlink_metadata(&file), &file);
|
||||
if metadata.mode() & 0o111 != 0 {
|
||||
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("ls-files")
|
||||
.arg(&git_friendly_path)
|
||||
.current_dir(path)
|
||||
.stdout(Stdio::null())
|
||||
.stderr(Stdio::null())
|
||||
.status()
|
||||
.unwrap_or_else(|e| {
|
||||
panic!("could not run git ls-files: {}", e);
|
||||
});
|
||||
if ret_code.success() {
|
||||
println!("binary checked into source: {}", file.display());
|
||||
*bad = true;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user