3
3
#include "git-compat-util.h"
4
4
#include "environment.h"
5
5
#include "gettext.h"
6
+ #include "trace2.h"
6
7
#include "config.h"
7
8
#include "dir.h"
8
9
#include "hashmap.h"
@@ -258,6 +259,11 @@ void apply_virtualfilesystem(struct index_state *istate)
258
259
{
259
260
char * buf , * entry ;
260
261
size_t i ;
262
+ int nr_unknown = 0 ;
263
+ int nr_vfs_dirs = 0 ;
264
+ int nr_vfs_rows = 0 ;
265
+ int nr_bulk_skip = 0 ;
266
+ int nr_explicit_skip = 0 ;
261
267
262
268
if (!repo_config_get_virtualfilesystem (istate -> repo ))
263
269
return ;
@@ -275,35 +281,63 @@ void apply_virtualfilesystem(struct index_state *istate)
275
281
if (buf [i ] == '\0' ) {
276
282
ssize_t pos , len ;
277
283
284
+ nr_vfs_rows ++ ;
285
+
278
286
len = buf + i - entry ;
279
287
280
288
/* look for a directory wild card (ie "dir1/") */
281
289
if (buf [i - 1 ] == '/' ) {
290
+ nr_vfs_dirs ++ ;
282
291
if (ignore_case )
283
292
adjust_dirname_case (istate , entry );
284
293
pos = index_name_pos (istate , entry , len );
285
294
if (pos < 0 ) {
286
295
pos = - pos - 1 ;
287
296
while ((size_t )pos < istate -> cache_nr && !fspathncmp (istate -> cache [pos ]-> name , entry , len )) {
297
+ if (istate -> cache [pos ]-> ce_flags & CE_SKIP_WORKTREE )
298
+ nr_bulk_skip ++ ;
288
299
istate -> cache [pos ]-> ce_flags &= ~CE_SKIP_WORKTREE ;
289
300
pos ++ ;
290
301
}
291
302
}
292
303
} else {
293
304
if (ignore_case ) {
294
305
struct cache_entry * ce = index_file_exists (istate , entry , len , ignore_case );
295
- if (ce )
306
+ if (ce ) {
307
+ if (ce -> ce_flags & CE_SKIP_WORKTREE )
308
+ nr_explicit_skip ++ ;
296
309
ce -> ce_flags &= ~CE_SKIP_WORKTREE ;
310
+ }
311
+ else {
312
+ nr_unknown ++ ;
313
+ }
297
314
} else {
298
315
int pos = index_name_pos (istate , entry , len );
299
- if (pos >= 0 )
316
+ if (pos >= 0 ) {
317
+ if (istate -> cache [pos ]-> ce_flags & CE_SKIP_WORKTREE )
318
+ nr_explicit_skip ++ ;
300
319
istate -> cache [pos ]-> ce_flags &= ~CE_SKIP_WORKTREE ;
320
+ }
321
+ else {
322
+ nr_unknown ++ ;
323
+ }
301
324
}
302
325
}
303
326
304
327
entry += len + 1 ;
305
328
}
306
329
}
330
+
331
+ if (nr_vfs_rows > 0 ) {
332
+ trace2_data_intmax ("vfs" , the_repository , "apply/tracked" , nr_bulk_skip + nr_explicit_skip );
333
+
334
+ trace2_data_intmax ("vfs" , the_repository , "apply/vfs_rows" , nr_vfs_rows );
335
+ trace2_data_intmax ("vfs" , the_repository , "apply/vfs_dirs" , nr_vfs_dirs );
336
+
337
+ trace2_data_intmax ("vfs" , the_repository , "apply/nr_unknown" , nr_unknown );
338
+ trace2_data_intmax ("vfs" , the_repository , "apply/nr_bulk_skip" , nr_bulk_skip );
339
+ trace2_data_intmax ("vfs" , the_repository , "apply/nr_explicit_skip" , nr_explicit_skip );
340
+ }
307
341
}
308
342
309
343
/*
0 commit comments