MCPcopy Create free account
hub / github.com/git/git / too_many_not_shared_entries

Function too_many_not_shared_entries

read-cache.c:3281–3307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3279static const int default_max_percent_split_change = 20;
3280
3281static int too_many_not_shared_entries(struct index_state *istate)
3282{
3283 int i, not_shared = 0;
3284 int max_split = repo_config_get_max_percent_split_change(the_repository);
3285
3286 switch (max_split) {
3287 case -1:
3288 /* not or badly configured: use the default value */
3289 max_split = default_max_percent_split_change;
3290 break;
3291 case 0:
3292 return 1; /* 0% means always write a new shared index */
3293 case 100:
3294 return 0; /* 100% means never write a new shared index */
3295 default:
3296 break; /* just use the configured value */
3297 }
3298
3299 /* Count not shared entries */
3300 for (i = 0; i < istate->cache_nr; i++) {
3301 struct cache_entry *ce = istate->cache[i];
3302 if (!ce->index)
3303 not_shared++;
3304 }
3305
3306 return (int64_t)istate->cache_nr * max_split < (int64_t)not_shared * 100;
3307}
3308
3309int write_locked_index(struct index_state *istate, struct lock_file *lock,
3310 unsigned flags)

Callers 1

write_locked_indexFunction · 0.85

Tested by

no test coverage detected