@@ -64,6 +64,7 @@ impl Repository {
6464 /// The path can point to either a normal or bare repository.
6565 pub fn open < P : AsRef < Path > > ( path : P ) -> Result < Repository , Error > {
6666 init ( ) ;
67+ // Normal file path OK (does not need Windows conversion).
6768 let path = path. as_ref ( ) . into_c_string ( ) ?;
6869 let mut ret = ptr:: null_mut ( ) ;
6970 unsafe {
@@ -77,6 +78,7 @@ impl Repository {
7778 /// The path can point to only a bare repository.
7879 pub fn open_bare < P : AsRef < Path > > ( path : P ) -> Result < Repository , Error > {
7980 init ( ) ;
81+ // Normal file path OK (does not need Windows conversion).
8082 let path = path. as_ref ( ) . into_c_string ( ) ?;
8183 let mut ret = ptr:: null_mut ( ) ;
8284 unsafe {
@@ -142,6 +144,7 @@ impl Repository {
142144 I : IntoIterator < Item = O > ,
143145 {
144146 init ( ) ;
147+ // Normal file path OK (does not need Windows conversion).
145148 let path = path. as_ref ( ) . into_c_string ( ) ?;
146149 let ceiling_dirs_os = env:: join_paths ( ceiling_dirs) ?;
147150 let ceiling_dirs = ceiling_dirs_os. into_c_string ( ) ?;
@@ -165,6 +168,7 @@ impl Repository {
165168 // TODO: this diverges significantly from the libgit2 API
166169 init ( ) ;
167170 let buf = Buf :: new ( ) ;
171+ // Normal file path OK (does not need Windows conversion).
168172 let path = path. as_ref ( ) . into_c_string ( ) ?;
169173 unsafe {
170174 try_call ! ( raw:: git_repository_discover(
@@ -201,6 +205,7 @@ impl Repository {
201205 opts : & RepositoryInitOptions ,
202206 ) -> Result < Repository , Error > {
203207 init ( ) ;
208+ // Normal file path OK (does not need Windows conversion).
204209 let path = path. as_ref ( ) . into_c_string ( ) ?;
205210 let mut ret = ptr:: null_mut ( ) ;
206211 unsafe {
@@ -393,6 +398,7 @@ impl Repository {
393398 /// and set config "core.worktree" (if workdir is not the parent of the .git
394399 /// directory).
395400 pub fn set_workdir ( & self , path : & Path , update_gitlink : bool ) -> Result < ( ) , Error > {
401+ // Normal file path OK (does not need Windows conversion).
396402 let path = path. into_c_string ( ) ?;
397403 unsafe {
398404 try_call ! ( raw:: git_repository_set_workdir(
@@ -856,7 +862,7 @@ impl Repository {
856862 /// directory containing the file, would it be added or not?
857863 pub fn status_should_ignore ( & self , path : & Path ) -> Result < bool , Error > {
858864 let mut ret = 0 as c_int ;
859- let path = path . into_c_string ( ) ?;
865+ let path = util :: cstring_to_repo_path ( path ) ?;
860866 unsafe {
861867 try_call ! ( raw:: git_status_should_ignore( & mut ret, self . raw, path) ) ;
862868 }
@@ -950,7 +956,7 @@ impl Repository {
950956 flags : AttrCheckFlags ,
951957 ) -> Result < Option < & [ u8 ] > , Error > {
952958 let mut ret = ptr:: null ( ) ;
953- let path = path . into_c_string ( ) ?;
959+ let path = util :: cstring_to_repo_path ( path ) ?;
954960 let name = CString :: new ( name) ?;
955961 unsafe {
956962 try_call ! ( raw:: git_attr_get(
@@ -991,6 +997,7 @@ impl Repository {
991997 /// The Oid returned can in turn be passed to `find_blob` to get a handle to
992998 /// the blob.
993999 pub fn blob_path ( & self , path : & Path ) -> Result < Oid , Error > {
1000+ // Normal file path OK (does not need Windows conversion).
9941001 let path = path. into_c_string ( ) ?;
9951002 let mut raw = raw:: git_oid {
9961003 id : [ 0 ; raw:: GIT_OID_RAWSZ ] ,
@@ -1545,7 +1552,7 @@ impl Repository {
15451552 use_gitlink : bool ,
15461553 ) -> Result < Submodule < ' _ > , Error > {
15471554 let url = CString :: new ( url) ?;
1548- let path = path . into_c_string ( ) ?;
1555+ let path = path_to_repo_path ( path ) ?;
15491556 let mut raw = ptr:: null_mut ( ) ;
15501557 unsafe {
15511558 try_call ! ( raw:: git_submodule_add_setup(
@@ -2069,7 +2076,7 @@ impl Repository {
20692076 path : & Path ,
20702077 opts : Option < & mut BlameOptions > ,
20712078 ) -> Result < Blame < ' _ > , Error > {
2072- let path = path . into_c_string ( ) ?;
2079+ let path = path_to_repo_path ( path ) ?;
20732080 let mut raw = ptr:: null_mut ( ) ;
20742081
20752082 unsafe {
@@ -2800,12 +2807,13 @@ impl RepositoryInitOptions {
28002807 self
28012808 }
28022809
2803- /// The path do the working directory.
2810+ /// The path to the working directory.
28042811 ///
28052812 /// If this is a relative path it will be evaulated relative to the repo
28062813 /// path. If this is not the "natural" working directory, a .git gitlink
28072814 /// file will be created here linking to the repo path.
28082815 pub fn workdir_path ( & mut self , path : & Path ) -> & mut RepositoryInitOptions {
2816+ // Normal file path OK (does not need Windows conversion).
28092817 self . workdir_path = Some ( path. into_c_string ( ) . unwrap ( ) ) ;
28102818 self
28112819 }
@@ -2823,6 +2831,7 @@ impl RepositoryInitOptions {
28232831 /// If this is not configured, then the default locations will be searched
28242832 /// instead.
28252833 pub fn template_path ( & mut self , path : & Path ) -> & mut RepositoryInitOptions {
2834+ // Normal file path OK (does not need Windows conversion).
28262835 self . template_path = Some ( path. into_c_string ( ) . unwrap ( ) ) ;
28272836 self
28282837 }
0 commit comments