@@ -64,6 +64,7 @@ impl Repository {
64
64
/// The path can point to either a normal or bare repository.
65
65
pub fn open < P : AsRef < Path > > ( path : P ) -> Result < Repository , Error > {
66
66
init ( ) ;
67
+ // Normal file path OK (does not need Windows conversion).
67
68
let path = path. as_ref ( ) . into_c_string ( ) ?;
68
69
let mut ret = ptr:: null_mut ( ) ;
69
70
unsafe {
@@ -77,6 +78,7 @@ impl Repository {
77
78
/// The path can point to only a bare repository.
78
79
pub fn open_bare < P : AsRef < Path > > ( path : P ) -> Result < Repository , Error > {
79
80
init ( ) ;
81
+ // Normal file path OK (does not need Windows conversion).
80
82
let path = path. as_ref ( ) . into_c_string ( ) ?;
81
83
let mut ret = ptr:: null_mut ( ) ;
82
84
unsafe {
@@ -142,6 +144,7 @@ impl Repository {
142
144
I : IntoIterator < Item = O > ,
143
145
{
144
146
init ( ) ;
147
+ // Normal file path OK (does not need Windows conversion).
145
148
let path = path. as_ref ( ) . into_c_string ( ) ?;
146
149
let ceiling_dirs_os = env:: join_paths ( ceiling_dirs) ?;
147
150
let ceiling_dirs = ceiling_dirs_os. into_c_string ( ) ?;
@@ -165,6 +168,7 @@ impl Repository {
165
168
// TODO: this diverges significantly from the libgit2 API
166
169
init ( ) ;
167
170
let buf = Buf :: new ( ) ;
171
+ // Normal file path OK (does not need Windows conversion).
168
172
let path = path. as_ref ( ) . into_c_string ( ) ?;
169
173
unsafe {
170
174
try_call ! ( raw:: git_repository_discover(
@@ -201,6 +205,7 @@ impl Repository {
201
205
opts : & RepositoryInitOptions ,
202
206
) -> Result < Repository , Error > {
203
207
init ( ) ;
208
+ // Normal file path OK (does not need Windows conversion).
204
209
let path = path. as_ref ( ) . into_c_string ( ) ?;
205
210
let mut ret = ptr:: null_mut ( ) ;
206
211
unsafe {
@@ -393,6 +398,7 @@ impl Repository {
393
398
/// and set config "core.worktree" (if workdir is not the parent of the .git
394
399
/// directory).
395
400
pub fn set_workdir ( & self , path : & Path , update_gitlink : bool ) -> Result < ( ) , Error > {
401
+ // Normal file path OK (does not need Windows conversion).
396
402
let path = path. into_c_string ( ) ?;
397
403
unsafe {
398
404
try_call ! ( raw:: git_repository_set_workdir(
@@ -856,7 +862,7 @@ impl Repository {
856
862
/// directory containing the file, would it be added or not?
857
863
pub fn status_should_ignore ( & self , path : & Path ) -> Result < bool , Error > {
858
864
let mut ret = 0 as c_int ;
859
- let path = path . into_c_string ( ) ?;
865
+ let path = util :: cstring_to_repo_path ( path ) ?;
860
866
unsafe {
861
867
try_call ! ( raw:: git_status_should_ignore( & mut ret, self . raw, path) ) ;
862
868
}
@@ -950,7 +956,7 @@ impl Repository {
950
956
flags : AttrCheckFlags ,
951
957
) -> Result < Option < & [ u8 ] > , Error > {
952
958
let mut ret = ptr:: null ( ) ;
953
- let path = path . into_c_string ( ) ?;
959
+ let path = util :: cstring_to_repo_path ( path ) ?;
954
960
let name = CString :: new ( name) ?;
955
961
unsafe {
956
962
try_call ! ( raw:: git_attr_get(
@@ -991,6 +997,7 @@ impl Repository {
991
997
/// The Oid returned can in turn be passed to `find_blob` to get a handle to
992
998
/// the blob.
993
999
pub fn blob_path ( & self , path : & Path ) -> Result < Oid , Error > {
1000
+ // Normal file path OK (does not need Windows conversion).
994
1001
let path = path. into_c_string ( ) ?;
995
1002
let mut raw = raw:: git_oid {
996
1003
id : [ 0 ; raw:: GIT_OID_RAWSZ ] ,
@@ -1545,7 +1552,7 @@ impl Repository {
1545
1552
use_gitlink : bool ,
1546
1553
) -> Result < Submodule < ' _ > , Error > {
1547
1554
let url = CString :: new ( url) ?;
1548
- let path = path . into_c_string ( ) ?;
1555
+ let path = path_to_repo_path ( path ) ?;
1549
1556
let mut raw = ptr:: null_mut ( ) ;
1550
1557
unsafe {
1551
1558
try_call ! ( raw:: git_submodule_add_setup(
@@ -2069,7 +2076,7 @@ impl Repository {
2069
2076
path : & Path ,
2070
2077
opts : Option < & mut BlameOptions > ,
2071
2078
) -> Result < Blame < ' _ > , Error > {
2072
- let path = path . into_c_string ( ) ?;
2079
+ let path = path_to_repo_path ( path ) ?;
2073
2080
let mut raw = ptr:: null_mut ( ) ;
2074
2081
2075
2082
unsafe {
@@ -2800,12 +2807,13 @@ impl RepositoryInitOptions {
2800
2807
self
2801
2808
}
2802
2809
2803
- /// The path do the working directory.
2810
+ /// The path to the working directory.
2804
2811
///
2805
2812
/// If this is a relative path it will be evaulated relative to the repo
2806
2813
/// path. If this is not the "natural" working directory, a .git gitlink
2807
2814
/// file will be created here linking to the repo path.
2808
2815
pub fn workdir_path ( & mut self , path : & Path ) -> & mut RepositoryInitOptions {
2816
+ // Normal file path OK (does not need Windows conversion).
2809
2817
self . workdir_path = Some ( path. into_c_string ( ) . unwrap ( ) ) ;
2810
2818
self
2811
2819
}
@@ -2823,6 +2831,7 @@ impl RepositoryInitOptions {
2823
2831
/// If this is not configured, then the default locations will be searched
2824
2832
/// instead.
2825
2833
pub fn template_path ( & mut self , path : & Path ) -> & mut RepositoryInitOptions {
2834
+ // Normal file path OK (does not need Windows conversion).
2826
2835
self . template_path = Some ( path. into_c_string ( ) . unwrap ( ) ) ;
2827
2836
self
2828
2837
}
0 commit comments