@@ -219,7 +219,20 @@ int has_symlink_leading_path(const char *name, int len)
219
219
*/
220
220
int check_leading_path (const char * name , int len )
221
221
{
222
- struct cache_def * cache = & default_cache ; /* FIXME */
222
+ return threaded_check_leading_path (& default_cache , name , len );
223
+ }
224
+
225
+ /*
226
+ * Return zero if path 'name' has a leading symlink component or
227
+ * if some leading path component does not exists.
228
+ *
229
+ * Return -1 if leading path exists and is a directory.
230
+ *
231
+ * Return path length if leading path exists and is neither a
232
+ * directory nor a symlink.
233
+ */
234
+ int threaded_check_leading_path (struct cache_def * cache , const char * name , int len )
235
+ {
223
236
int flags ;
224
237
int match_len = lstat_cache_matchlen (cache , name , len , & flags ,
225
238
FL_SYMLINK |FL_NOENT |FL_DIR , USE_ONLY_LSTAT );
@@ -240,7 +253,18 @@ int check_leading_path(const char *name, int len)
240
253
*/
241
254
int has_dirs_only_path (const char * name , int len , int prefix_len )
242
255
{
243
- struct cache_def * cache = & default_cache ; /* FIXME */
256
+ return threaded_has_dirs_only_path (& default_cache , name , len , prefix_len );
257
+ }
258
+
259
+ /*
260
+ * Return non-zero if all path components of 'name' exists as a
261
+ * directory. If prefix_len > 0, we will test with the stat()
262
+ * function instead of the lstat() function for a prefix length of
263
+ * 'prefix_len', thus we then allow for symlinks in the prefix part as
264
+ * long as those points to real existing directories.
265
+ */
266
+ int threaded_has_dirs_only_path (struct cache_def * cache , const char * name , int len , int prefix_len )
267
+ {
244
268
return lstat_cache (cache , name , len ,
245
269
FL_DIR |FL_FULLPATH , prefix_len ) &
246
270
FL_DIR ;
0 commit comments