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

Function prepare_pack

packfile.c:991–1026  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

989};
990
991static void prepare_pack(const char *full_name, size_t full_name_len,
992 const char *file_name, void *_data)
993{
994 struct prepare_pack_data *data = (struct prepare_pack_data *)_data;
995 struct odb_source_files *files = odb_source_files_downcast(data->source);
996 size_t base_len = full_name_len;
997
998 if (strip_suffix_mem(full_name, &base_len, ".idx") &&
999 !(files->packed->midx &&
1000 midx_contains_pack(files->packed->midx, file_name))) {
1001 char *trimmed_path = xstrndup(full_name, full_name_len);
1002 packfile_store_load_pack(files->packed,
1003 trimmed_path, data->source->local);
1004 free(trimmed_path);
1005 }
1006
1007 if (!report_garbage)
1008 return;
1009
1010 if (!strcmp(file_name, "multi-pack-index") ||
1011 !strcmp(file_name, "multi-pack-index.d"))
1012 return;
1013 if (starts_with(file_name, "multi-pack-index") &&
1014 (ends_with(file_name, ".bitmap") || ends_with(file_name, ".rev")))
1015 return;
1016 if (ends_with(file_name, ".idx") ||
1017 ends_with(file_name, ".rev") ||
1018 ends_with(file_name, ".pack") ||
1019 ends_with(file_name, ".bitmap") ||
1020 ends_with(file_name, ".keep") ||
1021 ends_with(file_name, ".promisor") ||
1022 ends_with(file_name, ".mtimes"))
1023 string_list_append(data->garbage, full_name);
1024 else
1025 report_garbage(PACKDIR_FILE_GARBAGE, full_name);
1026}
1027
1028static void prepare_packed_git_one(struct odb_source *source)
1029{

Callers

nothing calls this directly

Calls 8

strip_suffix_memFunction · 0.85
midx_contains_packFunction · 0.85
xstrndupFunction · 0.85
packfile_store_load_packFunction · 0.85
starts_withFunction · 0.85
ends_withFunction · 0.85
string_list_appendFunction · 0.70

Tested by

no test coverage detected