File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -84,8 +84,19 @@ impl Git {
84
84
/// Discover a Git repository on or above this directory, scanning it for
85
85
/// the files' statuses if one is found.
86
86
fn scan ( path : & Path ) -> Result < Git , git2:: Error > {
87
+ use std:: os:: unix:: OsStrExt ;
88
+ use std:: ffi:: AsOsStr ;
89
+
90
+ // TODO: libgit2-rs uses the new Path module, but exa still uses the
91
+ // old_path one, and will have to continue to do so until the new IO
92
+ // module gets a bit more developed. So we have to turn Paths into
93
+ // old_path::Paths. Yes, this is hacky, but hopefully temporary.
87
94
let repo = try!( git2:: Repository :: discover ( path) ) ;
88
- let workdir = repo. workdir ( ) . unwrap_or ( Path :: new ( "." ) ) ;
95
+ let workdir = match repo. workdir ( ) {
96
+ Some ( w) => Path :: new ( w. as_os_str ( ) . as_bytes ( ) ) ,
97
+ None => return Ok ( Git { statuses : vec ! [ ] } ) , // bare repo
98
+ } ;
99
+
89
100
let statuses = try!( repo. statuses ( None ) ) . iter ( )
90
101
. map ( |e| ( workdir. join ( e. path_bytes ( ) ) , e. status ( ) ) )
91
102
. collect ( ) ;
You can’t perform that action at this time.
0 commit comments