]>
git.proxmox.com Git - rustc.git/blob - src/tools/tidy/src/cargo_lock.rs
1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
14 const CARGO_LOCK
: &'
static str = "Cargo.lock";
16 pub fn check(path
: &Path
, bad
: &mut bool
) {
17 use std
::process
::Command
;
20 &mut |path
| super::filter_dirs(path
) || path
.ends_with("src/test"),
22 if let Some(CARGO_LOCK
) = file
.file_name().and_then(OsStr
::to_str
) {
23 let rel_path
= file
.strip_prefix(path
).unwrap();
24 let git_friendly_path
= rel_path
.to_str().unwrap().replace("\\", "/");
25 let ret_code
= Command
::new("git")
30 .arg(&git_friendly_path
)
34 panic
!("could not run git diff-index: {}", e
);
36 if !ret_code
.success() {
37 let parent_path
= file
.parent().unwrap().join("Cargo.toml");
38 print
!("dirty lock file found at {} ", rel_path
.display());
39 println
!("please commit your changes or update the lock file by running:");
40 println
!("\n\tcargo update --manifest-path {}", parent_path
.display());