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

Function find_deltas

builtin/pack-objects.c:2972–3112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2970}
2971
2972static void find_deltas(struct object_entry **list, unsigned *list_size,
2973 int window, int depth, unsigned *processed)
2974{
2975 uint32_t i, idx = 0, count = 0;
2976 struct unpacked *array;
2977 unsigned long mem_usage = 0;
2978
2979 CALLOC_ARRAY(array, window);
2980
2981 for (;;) {
2982 struct object_entry *entry;
2983 struct unpacked *n = array + idx;
2984 int j, max_depth, best_base = -1;
2985
2986 progress_lock();
2987 if (!*list_size) {
2988 progress_unlock();
2989 break;
2990 }
2991 entry = *list++;
2992 (*list_size)--;
2993 if (!entry->preferred_base) {
2994 (*processed)++;
2995 display_progress(progress_state, *processed);
2996 }
2997 progress_unlock();
2998
2999 mem_usage -= free_unpacked(n);
3000 n->entry = entry;
3001
3002 while (window_memory_limit &&
3003 mem_usage > window_memory_limit &&
3004 count > 1) {
3005 const uint32_t tail = (idx + window - count) % window;
3006 mem_usage -= free_unpacked(array + tail);
3007 count--;
3008 }
3009
3010 /* We do not compute delta to *create* objects we are not
3011 * going to pack.
3012 */
3013 if (entry->preferred_base)
3014 goto next;
3015
3016 /*
3017 * If the current object is at pack edge, take the depth the
3018 * objects that depend on the current object into account
3019 * otherwise they would become too deep.
3020 */
3021 max_depth = depth;
3022 if (DELTA_CHILD(entry)) {
3023 max_depth -= check_delta_limit(entry, 0);
3024 if (max_depth <= 0)
3025 goto next;
3026 }
3027
3028 j = window;
3029 while (--j > 0) {

Callers 3

threaded_find_deltasFunction · 0.85
ll_find_deltasFunction · 0.85
find_deltas_for_regionFunction · 0.85

Calls 6

display_progressFunction · 0.85
free_unpackedFunction · 0.85
check_delta_limitFunction · 0.85
try_deltaFunction · 0.85
free_delta_indexFunction · 0.85
do_compressFunction · 0.70

Tested by

no test coverage detected