@@ -137,7 +137,7 @@ impl Cache {
137
137
138
138
let install_dir = crate :: path:: install_dir ( ) . ok ( ) ;
139
139
let home = self . home_dir ( ) ;
140
- let ctx = crate :: config:: cache:: interpolate_context ( install_dir. as_deref ( ) , home. as_deref ( ) ) ;
140
+ let ctx = config:: cache:: interpolate_context ( install_dir. as_deref ( ) , home. as_deref ( ) ) ;
141
141
Some ( path. interpolate ( ctx) )
142
142
}
143
143
@@ -154,6 +154,23 @@ impl Cache {
154
154
} )
155
155
}
156
156
157
+ #[ cfg( feature = "index" ) ]
158
+ pub ( crate ) fn stat_options ( & self ) -> Result < gix_index:: entry:: stat:: Options , config:: stat_options:: Error > {
159
+ use crate :: config:: tree:: gitoxide;
160
+ Ok ( gix_index:: entry:: stat:: Options {
161
+ trust_ctime : boolean ( self , "core.trustCTime" , & Core :: TRUST_C_TIME , true ) ?,
162
+ use_nsec : boolean ( self , "gitoxide.core.useNsec" , & gitoxide:: Core :: USE_NSEC , false ) ?,
163
+ use_stdev : boolean ( self , "gitoxide.core.useStdev" , & gitoxide:: Core :: USE_STDEV , false ) ?,
164
+ check_stat : self
165
+ . apply_leniency (
166
+ self . resolved
167
+ . string ( "core" , None , "checkStat" )
168
+ . map ( |v| Core :: CHECK_STAT . try_into_checkstat ( v) ) ,
169
+ ) ?
170
+ . unwrap_or ( true ) ,
171
+ } )
172
+ }
173
+
157
174
/// Collect everything needed to checkout files into a worktree.
158
175
/// Note that some of the options being returned will be defaulted so safe settings, the caller might have to override them
159
176
/// depending on the use-case.
@@ -162,7 +179,7 @@ impl Cache {
162
179
& self ,
163
180
repo : & crate :: Repository ,
164
181
attributes_source : gix_worktree:: stack:: state:: attributes:: Source ,
165
- ) -> Result < gix_worktree_state:: checkout:: Options , crate :: config:: checkout_options:: Error > {
182
+ ) -> Result < gix_worktree_state:: checkout:: Options , config:: checkout_options:: Error > {
166
183
use crate :: config:: tree:: gitoxide;
167
184
let git_dir = repo. git_dir ( ) ;
168
185
let thread_limit = self . apply_leniency (
@@ -202,18 +219,12 @@ impl Cache {
202
219
destination_is_initially_empty : false ,
203
220
overwrite_existing : false ,
204
221
keep_going : false ,
205
- stat_options : gix_index:: entry:: stat:: Options {
206
- trust_ctime : boolean ( self , "core.trustCTime" , & Core :: TRUST_C_TIME , true ) ?,
207
- use_nsec : boolean ( self , "gitoxide.core.useNsec" , & gitoxide:: Core :: USE_NSEC , false ) ?,
208
- use_stdev : boolean ( self , "gitoxide.core.useStdev" , & gitoxide:: Core :: USE_STDEV , false ) ?,
209
- check_stat : self
210
- . apply_leniency (
211
- self . resolved
212
- . string ( "core" , None , "checkStat" )
213
- . map ( |v| Core :: CHECK_STAT . try_into_checkstat ( v) ) ,
214
- ) ?
215
- . unwrap_or ( true ) ,
216
- } ,
222
+ stat_options : self . stat_options ( ) . map_err ( |err| match err {
223
+ config:: stat_options:: Error :: ConfigCheckStat ( err) => {
224
+ config:: checkout_options:: Error :: ConfigCheckStat ( err)
225
+ }
226
+ config:: stat_options:: Error :: ConfigBoolean ( err) => config:: checkout_options:: Error :: ConfigBoolean ( err) ,
227
+ } ) ?,
217
228
} )
218
229
}
219
230
0 commit comments