File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 99// except according to those terms.
1010
1111use std:: path:: Path ;
12+ use std:: ffi:: OsStr ;
1213
1314const 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| {
You can’t perform that action at this time.
0 commit comments