File tree 1 file changed +7
-5
lines changed
1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 9
9
// except according to those terms.
10
10
11
11
use std:: path:: Path ;
12
+ use std:: ffi:: OsStr ;
12
13
13
14
const CARGO_LOCK : & ' static str = "Cargo.lock" ;
14
15
@@ -18,14 +19,15 @@ pub fn check(path: &Path, bad: &mut bool) {
18
19
super :: walk ( path,
19
20
& mut |path| super :: filter_dirs ( path) || path. ends_with ( "src/test" ) ,
20
21
& 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) {
23
23
let rel_path = file. strip_prefix ( path) . unwrap ( ) ;
24
+ let git_friendly_path = rel_path. to_str ( ) . unwrap ( ) . replace ( "\\ " , "/" ) ;
24
25
let ret_code = Command :: new ( "git" )
25
- . arg ( "diff-index" )
26
- . arg ( "--quiet" )
26
+ . arg ( "diff" )
27
+ . arg ( "--exit-code" )
28
+ . arg ( "--patch" )
27
29
. arg ( "HEAD" )
28
- . arg ( rel_path )
30
+ . arg ( & git_friendly_path )
29
31
. current_dir ( path)
30
32
. status ( )
31
33
. unwrap_or_else ( |e| {
You can’t perform that action at this time.
0 commit comments