alloc_state_alloc:
   40|    300|{
   41|    300|	return xcalloc(1, sizeof(struct alloc_state));
   42|    300|}
alloc_state_free_and_null:
   45|    300|{
   46|    300|	struct alloc_state *s = *s_;
   47|       |
   48|    300|	if (!s)
  ------------------
  |  Branch (48:6): [True: 0, False: 300]
  ------------------
   49|      0|		return;
   50|       |
   51|    300|	while (s->slab_nr > 0) {
  ------------------
  |  Branch (51:9): [True: 0, False: 300]
  ------------------
   52|      0|		s->slab_nr--;
   53|      0|		free(s->slabs[s->slab_nr]);
   54|      0|	}
   55|       |
   56|    300|	FREE_AND_NULL(s->slabs);
  ------------------
  |  |  756|    300|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 300]
  |  |  ------------------
  ------------------
   57|       |	FREE_AND_NULL(*s_);
  ------------------
  |  |  756|    300|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 300]
  |  |  ------------------
  ------------------
   58|    300|}

cache_tree_free:
   32|     60|{
   33|     60|	int i;
   34|     60|	struct cache_tree *it = *it_p;
   35|       |
   36|     60|	if (!it)
  ------------------
  |  Branch (36:6): [True: 60, False: 0]
  ------------------
   37|     60|		return;
   38|      0|	for (i = 0; i < it->subtree_nr; i++)
  ------------------
  |  Branch (38:14): [True: 0, False: 0]
  ------------------
   39|      0|		if (it->down[i]) {
  ------------------
  |  Branch (39:7): [True: 0, False: 0]
  ------------------
   40|      0|			cache_tree_free(&it->down[i]->cache_tree);
   41|      0|			free(it->down[i]);
   42|      0|		}
   43|      0|	free(it->down);
   44|      0|	free(it);
   45|       |	*it_p = NULL;
   46|      0|}

init_chunkfile:
   33|     55|{
   34|     55|	struct chunkfile *cf = xcalloc(1, sizeof(*cf));
   35|     55|	cf->f = f;
   36|     55|	return cf;
   37|     55|}
free_chunkfile:
   40|     55|{
   41|     55|	if (!cf)
  ------------------
  |  Branch (41:6): [True: 0, False: 55]
  ------------------
   42|      0|		return;
   43|     55|	free(cf->chunks);
   44|     55|	free(cf);
   45|     55|}
read_table_of_contents:
  110|     55|{
  111|     55|	int i;
  112|     55|	uint32_t chunk_id;
  113|     55|	const unsigned char *table_of_contents = mfile + toc_offset;
  114|       |
  115|     55|	ALLOC_GROW(cf->chunks, toc_length, cf->chunks_alloc);
  ------------------
  |  |  887|     55|	do { \
  |  |  888|     55|		if ((nr) > alloc) { \
  |  |  ------------------
  |  |  |  Branch (888:7): [True: 46, False: 9]
  |  |  ------------------
  |  |  889|     46|			if (alloc_nr(alloc) < (nr)) \
  |  |  ------------------
  |  |  |  |  841|     46|#define alloc_nr(x) (((x)+16)*3/2)
  |  |  ------------------
  |  |  |  Branch (889:8): [True: 9, False: 37]
  |  |  ------------------
  |  |  890|     46|				alloc = (nr); \
  |  |  891|     46|			else \
  |  |  892|     46|				alloc = alloc_nr(alloc); \
  |  |  ------------------
  |  |  |  |  841|     83|#define alloc_nr(x) (((x)+16)*3/2)
  |  |  ------------------
  |  |  893|     46|			REALLOC_ARRAY(x, alloc); \
  |  |  ------------------
  |  |  |  |  760|     46|#define REALLOC_ARRAY(x, alloc) (x) = xrealloc((x), st_mult(sizeof(*(x)), (alloc)))
  |  |  ------------------
  |  |  894|     46|		} \
  |  |  895|     55|	} while (0)
  |  |  ------------------
  |  |  |  Branch (895:11): [Folded, False: 55]
  |  |  ------------------
  ------------------
  116|       |
  117|    176|	while (toc_length--) {
  ------------------
  |  Branch (117:9): [True: 136, False: 40]
  ------------------
  118|    136|		uint64_t chunk_offset, next_chunk_offset;
  119|       |
  120|    136|		chunk_id = get_be32(table_of_contents);
  121|    136|		chunk_offset = get_be64(table_of_contents + 4);
  122|       |
  123|    136|		if (!chunk_id) {
  ------------------
  |  Branch (123:7): [True: 1, False: 135]
  ------------------
  124|      1|			error(_("terminating chunk id appears earlier than expected"));
  ------------------
  |  |  456|      1|#define error(...) (error(__VA_ARGS__), const_error())
  ------------------
  125|      1|			return 1;
  126|      1|		}
  127|    135|		if (chunk_offset % expected_alignment != 0) {
  ------------------
  |  Branch (127:7): [True: 0, False: 135]
  ------------------
  128|      0|			error(_("chunk id %"PRIx32" not %d-byte aligned"),
  ------------------
  |  |  456|      0|#define error(...) (error(__VA_ARGS__), const_error())
  ------------------
  129|      0|			      chunk_id, expected_alignment);
  130|      0|			return 1;
  131|      0|		}
  132|       |
  133|    135|		table_of_contents += CHUNK_TOC_ENTRY_SIZE;
  ------------------
  |  |    9|    135|#define CHUNK_TOC_ENTRY_SIZE (sizeof(uint32_t) + sizeof(uint64_t))
  ------------------
  134|    135|		next_chunk_offset = get_be64(table_of_contents + 4);
  135|       |
  136|    135|		if (next_chunk_offset < chunk_offset ||
  ------------------
  |  Branch (136:7): [True: 0, False: 135]
  ------------------
  137|    135|		    next_chunk_offset > mfile_size - the_hash_algo->rawsz) {
  ------------------
  |  |  273|    135|# define the_hash_algo the_repository->hash_algo
  ------------------
  |  Branch (137:7): [True: 14, False: 121]
  ------------------
  138|     14|			error(_("improper chunk offset(s) %"PRIx64" and %"PRIx64""),
  ------------------
  |  |  456|     14|#define error(...) (error(__VA_ARGS__), const_error())
  ------------------
  139|     14|			      chunk_offset, next_chunk_offset);
  140|     14|			return -1;
  141|     14|		}
  142|       |
  143|    673|		for (i = 0; i < cf->chunks_nr; i++) {
  ------------------
  |  Branch (143:15): [True: 552, False: 121]
  ------------------
  144|    552|			if (cf->chunks[i].id == chunk_id) {
  ------------------
  |  Branch (144:8): [True: 0, False: 552]
  ------------------
  145|      0|				error(_("duplicate chunk ID %"PRIx32" found"),
  ------------------
  |  |  456|      0|#define error(...) (error(__VA_ARGS__), const_error())
  ------------------
  146|      0|					chunk_id);
  147|      0|				return -1;
  148|      0|			}
  149|    552|		}
  150|       |
  151|    121|		cf->chunks[cf->chunks_nr].id = chunk_id;
  152|    121|		cf->chunks[cf->chunks_nr].start = mfile + chunk_offset;
  153|    121|		cf->chunks[cf->chunks_nr].size = next_chunk_offset - chunk_offset;
  154|    121|		cf->chunks_nr++;
  155|    121|	}
  156|       |
  157|     40|	chunk_id = get_be32(table_of_contents);
  158|     40|	if (chunk_id) {
  ------------------
  |  Branch (158:6): [True: 10, False: 30]
  ------------------
  159|     10|		error(_("final chunk has non-zero id %"PRIx32""), chunk_id);
  ------------------
  |  |  456|     10|#define error(...) (error(__VA_ARGS__), const_error())
  ------------------
  160|     10|		return -1;
  161|     10|	}
  162|       |
  163|     30|	return 0;
  164|     40|}
read_chunk:
  194|     50|{
  195|     50|	int i;
  196|       |
  197|    188|	for (i = 0; i < cf->chunks_nr; i++) {
  ------------------
  |  Branch (197:14): [True: 184, False: 4]
  ------------------
  198|    184|		if (cf->chunks[i].id == chunk_id)
  ------------------
  |  Branch (198:7): [True: 46, False: 138]
  ------------------
  199|     46|			return fn(cf->chunks[i].start, cf->chunks[i].size, data);
  200|    184|	}
  201|       |
  202|      4|	return CHUNK_NOT_FOUND;
  ------------------
  |  |   42|      4|#define CHUNK_NOT_FOUND (-2)
  ------------------
  203|     50|}
oid_version:
  206|     56|{
  207|     56|	switch (hash_algo_by_ptr(algop)) {
  208|     56|	case GIT_HASH_SHA1:
  ------------------
  |  |  189|     56|#define GIT_HASH_SHA1 1
  ------------------
  |  Branch (208:2): [True: 56, False: 0]
  ------------------
  209|     56|		return 1;
  210|      0|	case GIT_HASH_SHA256:
  ------------------
  |  |  191|      0|#define GIT_HASH_SHA256 2
  ------------------
  |  Branch (210:2): [True: 0, False: 56]
  ------------------
  211|      0|		return 2;
  212|      0|	default:
  ------------------
  |  Branch (212:2): [True: 0, False: 56]
  ------------------
  213|      0|		die(_("invalid hash version"));
  214|     56|	}
  215|     56|}

parse_commit_graph:
  375|     60|{
  376|     60|	const unsigned char *data;
  377|     60|	struct commit_graph *graph;
  378|     60|	uint32_t graph_signature;
  379|     60|	unsigned char graph_version, hash_version;
  380|     60|	struct chunkfile *cf = NULL;
  381|       |
  382|     60|	if (!graph_map)
  ------------------
  |  Branch (382:6): [True: 0, False: 60]
  ------------------
  383|      0|		return NULL;
  384|       |
  385|     60|	if (graph_size < graph_min_size(r->hash_algo))
  ------------------
  |  Branch (385:6): [True: 0, False: 60]
  ------------------
  386|      0|		return NULL;
  387|       |
  388|     60|	data = (const unsigned char *)graph_map;
  389|       |
  390|     60|	graph_signature = get_be32(data);
  391|     60|	if (graph_signature != GRAPH_SIGNATURE) {
  ------------------
  |  |   44|     60|#define GRAPH_SIGNATURE 0x43475048 /* "CGPH" */
  ------------------
  |  Branch (391:6): [True: 4, False: 56]
  ------------------
  392|      4|		error(_("commit-graph signature %X does not match signature %X"),
  ------------------
  |  |  456|      4|#define error(...) (error(__VA_ARGS__), const_error())
  ------------------
  393|      4|		      graph_signature, GRAPH_SIGNATURE);
  394|      4|		return NULL;
  395|      4|	}
  396|       |
  397|     56|	graph_version = *(unsigned char*)(data + 4);
  398|     56|	if (graph_version != GRAPH_VERSION) {
  ------------------
  |  |   56|     56|#define GRAPH_VERSION GRAPH_VERSION_1
  |  |  ------------------
  |  |  |  |   55|     56|#define GRAPH_VERSION_1 0x1
  |  |  ------------------
  ------------------
  |  Branch (398:6): [True: 0, False: 56]
  ------------------
  399|      0|		error(_("commit-graph version %X does not match version %X"),
  ------------------
  |  |  456|      0|#define error(...) (error(__VA_ARGS__), const_error())
  ------------------
  400|      0|		      graph_version, GRAPH_VERSION);
  401|      0|		return NULL;
  402|      0|	}
  403|       |
  404|     56|	hash_version = *(unsigned char*)(data + 5);
  405|     56|	if (hash_version != oid_version(r->hash_algo)) {
  ------------------
  |  Branch (405:6): [True: 0, False: 56]
  ------------------
  406|      0|		error(_("commit-graph hash version %X does not match version %X"),
  ------------------
  |  |  456|      0|#define error(...) (error(__VA_ARGS__), const_error())
  ------------------
  407|      0|		      hash_version, oid_version(r->hash_algo));
  408|      0|		return NULL;
  409|      0|	}
  410|       |
  411|     56|	graph = alloc_commit_graph();
  412|       |
  413|     56|	graph->hash_algo = r->hash_algo;
  414|     56|	graph->num_chunks = *(unsigned char*)(data + 6);
  415|     56|	graph->data = graph_map;
  416|     56|	graph->data_len = graph_size;
  417|       |
  418|     56|	if (graph_size < GRAPH_HEADER_SIZE +
  ------------------
  |  |   64|     56|#define GRAPH_HEADER_SIZE 8
  ------------------
  |  Branch (418:6): [True: 1, False: 55]
  ------------------
  419|     56|			 (graph->num_chunks + 1) * CHUNK_TOC_ENTRY_SIZE +
  ------------------
  |  |    9|     56|#define CHUNK_TOC_ENTRY_SIZE (sizeof(uint32_t) + sizeof(uint64_t))
  ------------------
  420|     56|			 GRAPH_FANOUT_SIZE + r->hash_algo->rawsz) {
  ------------------
  |  |   65|     56|#define GRAPH_FANOUT_SIZE (4 * 256)
  ------------------
  421|      1|		error(_("commit-graph file is too small to hold %u chunks"),
  ------------------
  |  |  456|      1|#define error(...) (error(__VA_ARGS__), const_error())
  ------------------
  422|      1|		      graph->num_chunks);
  423|      1|		free(graph);
  424|      1|		return NULL;
  425|      1|	}
  426|       |
  427|     55|	cf = init_chunkfile(NULL);
  428|       |
  429|     55|	if (read_table_of_contents(cf, graph->data, graph_size,
  ------------------
  |  Branch (429:6): [True: 25, False: 30]
  ------------------
  430|     55|				   GRAPH_HEADER_SIZE, graph->num_chunks, 1))
  ------------------
  |  |   64|     55|#define GRAPH_HEADER_SIZE 8
  ------------------
  431|     25|		goto free_and_return;
  432|       |
  433|     30|	if (read_chunk(cf, GRAPH_CHUNKID_OIDFANOUT, graph_read_oid_fanout, graph)) {
  ------------------
  |  |   45|     30|#define GRAPH_CHUNKID_OIDFANOUT 0x4f494446 /* "OIDF" */
  ------------------
  |  Branch (433:6): [True: 17, False: 13]
  ------------------
  434|     17|		error(_("commit-graph required OID fanout chunk missing or corrupted"));
  ------------------
  |  |  456|     17|#define error(...) (error(__VA_ARGS__), const_error())
  ------------------
  435|     17|		goto free_and_return;
  436|     17|	}
  437|     13|	if (read_chunk(cf, GRAPH_CHUNKID_OIDLOOKUP, graph_read_oid_lookup, graph)) {
  ------------------
  |  |   46|     13|#define GRAPH_CHUNKID_OIDLOOKUP 0x4f49444c /* "OIDL" */
  ------------------
  |  Branch (437:6): [True: 6, False: 7]
  ------------------
  438|      6|		error(_("commit-graph required OID lookup chunk missing or corrupted"));
  ------------------
  |  |  456|      6|#define error(...) (error(__VA_ARGS__), const_error())
  ------------------
  439|      6|		goto free_and_return;
  440|      6|	}
  441|      7|	if (read_chunk(cf, GRAPH_CHUNKID_DATA, graph_read_commit_data, graph)) {
  ------------------
  |  |   47|      7|#define GRAPH_CHUNKID_DATA 0x43444154 /* "CDAT" */
  ------------------
  |  Branch (441:6): [True: 7, False: 0]
  ------------------
  442|      7|		error(_("commit-graph required commit data chunk missing or corrupted"));
  ------------------
  |  |  456|      7|#define error(...) (error(__VA_ARGS__), const_error())
  ------------------
  443|      7|		goto free_and_return;
  444|      7|	}
  445|       |
  446|      0|	pair_chunk(cf, GRAPH_CHUNKID_EXTRAEDGES, &graph->chunk_extra_edges,
  ------------------
  |  |   50|      0|#define GRAPH_CHUNKID_EXTRAEDGES 0x45444745 /* "EDGE" */
  ------------------
  447|      0|		   &graph->chunk_extra_edges_size);
  448|      0|	pair_chunk(cf, GRAPH_CHUNKID_BASE, &graph->chunk_base_graphs,
  ------------------
  |  |   53|      0|#define GRAPH_CHUNKID_BASE 0x42415345 /* "BASE" */
  ------------------
  449|      0|		   &graph->chunk_base_graphs_size);
  450|       |
  451|      0|	prepare_repo_settings(r);
  452|       |
  453|      0|	if (r->settings.commit_graph_generation_version >= 2) {
  ------------------
  |  Branch (453:6): [True: 0, False: 0]
  ------------------
  454|      0|		read_chunk(cf, GRAPH_CHUNKID_GENERATION_DATA,
  ------------------
  |  |   48|      0|#define GRAPH_CHUNKID_GENERATION_DATA 0x47444132 /* "GDA2" */
  ------------------
  455|      0|			   graph_read_generation_data, graph);
  456|      0|		pair_chunk(cf, GRAPH_CHUNKID_GENERATION_DATA_OVERFLOW,
  ------------------
  |  |   49|      0|#define GRAPH_CHUNKID_GENERATION_DATA_OVERFLOW 0x47444f32 /* "GDO2" */
  ------------------
  457|      0|			   &graph->chunk_generation_data_overflow,
  458|      0|			   &graph->chunk_generation_data_overflow_size);
  459|       |
  460|      0|		if (graph->chunk_generation_data)
  ------------------
  |  Branch (460:7): [True: 0, False: 0]
  ------------------
  461|      0|			graph->read_generation_data = 1;
  462|      0|	}
  463|       |
  464|      0|	if (r->settings.commit_graph_changed_paths_version) {
  ------------------
  |  Branch (464:6): [True: 0, False: 0]
  ------------------
  465|      0|		read_chunk(cf, GRAPH_CHUNKID_BLOOMINDEXES,
  ------------------
  |  |   51|      0|#define GRAPH_CHUNKID_BLOOMINDEXES 0x42494458 /* "BIDX" */
  ------------------
  466|      0|			   graph_read_bloom_index, graph);
  467|      0|		read_chunk(cf, GRAPH_CHUNKID_BLOOMDATA,
  ------------------
  |  |   52|      0|#define GRAPH_CHUNKID_BLOOMDATA 0x42444154 /* "BDAT" */
  ------------------
  468|      0|			   graph_read_bloom_data, graph);
  469|      0|	}
  470|       |
  471|      0|	if (graph->chunk_bloom_indexes && graph->chunk_bloom_data) {
  ------------------
  |  Branch (471:6): [True: 0, False: 0]
  |  Branch (471:36): [True: 0, False: 0]
  ------------------
  472|      0|		init_bloom_filters();
  473|      0|	} else {
  474|       |		/* We need both the bloom chunks to exist together. Else ignore the data */
  475|      0|		graph->chunk_bloom_indexes = NULL;
  476|      0|		graph->chunk_bloom_data = NULL;
  477|      0|		FREE_AND_NULL(graph->bloom_filter_settings);
  ------------------
  |  |  756|      0|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
  478|      0|	}
  479|       |
  480|      0|	oidread(&graph->oid, graph->data + graph->data_len - graph->hash_algo->rawsz,
  481|      0|		r->hash_algo);
  482|       |
  483|      0|	free_chunkfile(cf);
  484|      0|	return graph;
  485|       |
  486|     55|free_and_return:
  487|     55|	free_chunkfile(cf);
  488|     55|	free(graph->bloom_filter_settings);
  489|     55|	free(graph);
  490|       |	return NULL;
  491|      7|}
free_commit_graph:
 2951|     60|{
 2952|     60|	while (g) {
  ------------------
  |  Branch (2952:9): [True: 0, False: 60]
  ------------------
 2953|      0|		struct commit_graph *next = g->base_graph;
 2954|       |
 2955|      0|		if (g->data)
  ------------------
  |  Branch (2955:7): [True: 0, False: 0]
  ------------------
 2956|      0|			munmap((void *)g->data, g->data_len);
 2957|      0|		free(g->filename);
 2958|      0|		free(g->bloom_filter_settings);
 2959|      0|		free(g);
 2960|       |
 2961|      0|		g = next;
 2962|      0|	}
 2963|     60|}
commit-graph.c:graph_min_size:
   84|     60|{
   85|     60|	return GRAPH_HEADER_SIZE + 4 * CHUNK_TOC_ENTRY_SIZE + GRAPH_FANOUT_SIZE + algop->rawsz;
  ------------------
  |  |   64|     60|#define GRAPH_HEADER_SIZE 8
  ------------------
              	return GRAPH_HEADER_SIZE + 4 * CHUNK_TOC_ENTRY_SIZE + GRAPH_FANOUT_SIZE + algop->rawsz;
  ------------------
  |  |    9|     60|#define CHUNK_TOC_ENTRY_SIZE (sizeof(uint32_t) + sizeof(uint64_t))
  ------------------
              	return GRAPH_HEADER_SIZE + 4 * CHUNK_TOC_ENTRY_SIZE + GRAPH_FANOUT_SIZE + algop->rawsz;
  ------------------
  |  |   65|     60|#define GRAPH_FANOUT_SIZE (4 * 256)
  ------------------
   86|     60|}
commit-graph.c:alloc_commit_graph:
  217|     56|{
  218|     56|	struct commit_graph *g = xcalloc(1, sizeof(*g));
  219|       |
  220|     56|	return g;
  221|     56|}
commit-graph.c:graph_read_oid_fanout:
  284|     27|{
  285|     27|	struct commit_graph *g = data;
  286|     27|	int i;
  287|       |
  288|     27|	if (chunk_size != 256 * sizeof(uint32_t))
  ------------------
  |  Branch (288:6): [True: 9, False: 18]
  ------------------
  289|      9|		return error(_("commit-graph oid fanout chunk is wrong size"));
  ------------------
  |  |  456|      9|#define error(...) (error(__VA_ARGS__), const_error())
  ------------------
  290|     18|	g->chunk_oid_fanout = (const uint32_t *)chunk_start;
  291|     18|	g->num_commits = ntohl(g->chunk_oid_fanout[255]);
  ------------------
  |  |  114|     18|#  define ntohl(x) bswap32(x)
  |  |  ------------------
  |  |  |  |   59|     18|#define bswap32(x) __builtin_bswap32((x))
  |  |  ------------------
  ------------------
  292|       |
  293|  3.52k|	for (i = 0; i < 255; i++) {
  ------------------
  |  Branch (293:14): [True: 3.51k, False: 13]
  ------------------
  294|  3.51k|		uint32_t oid_fanout1 = ntohl(g->chunk_oid_fanout[i]);
  ------------------
  |  |  114|  3.51k|#  define ntohl(x) bswap32(x)
  |  |  ------------------
  |  |  |  |   59|  3.51k|#define bswap32(x) __builtin_bswap32((x))
  |  |  ------------------
  ------------------
  295|  3.51k|		uint32_t oid_fanout2 = ntohl(g->chunk_oid_fanout[i + 1]);
  ------------------
  |  |  114|  3.51k|#  define ntohl(x) bswap32(x)
  |  |  ------------------
  |  |  |  |   59|  3.51k|#define bswap32(x) __builtin_bswap32((x))
  |  |  ------------------
  ------------------
  296|       |
  297|  3.51k|		if (oid_fanout1 > oid_fanout2) {
  ------------------
  |  Branch (297:7): [True: 5, False: 3.50k]
  ------------------
  298|      5|			error(_("commit-graph fanout values out of order"));
  ------------------
  |  |  456|      5|#define error(...) (error(__VA_ARGS__), const_error())
  ------------------
  299|      5|			return 1;
  300|      5|		}
  301|  3.51k|	}
  302|       |
  303|     13|	return 0;
  304|     18|}
commit-graph.c:graph_read_oid_lookup:
  308|     12|{
  309|     12|	struct commit_graph *g = data;
  310|     12|	g->chunk_oid_lookup = chunk_start;
  311|     12|	if (chunk_size / g->hash_algo->rawsz != g->num_commits)
  ------------------
  |  Branch (311:6): [True: 5, False: 7]
  ------------------
  312|      5|		return error(_("commit-graph OID lookup chunk is the wrong size"));
  ------------------
  |  |  456|      5|#define error(...) (error(__VA_ARGS__), const_error())
  ------------------
  313|      7|	return 0;
  314|     12|}
commit-graph.c:graph_read_commit_data:
  318|      7|{
  319|      7|	struct commit_graph *g = data;
  320|      7|	if (chunk_size / graph_data_width(g->hash_algo) != g->num_commits)
  ------------------
  |  Branch (320:6): [True: 7, False: 0]
  ------------------
  321|      7|		return error(_("commit-graph commit data chunk is wrong size"));
  ------------------
  |  |  456|      7|#define error(...) (error(__VA_ARGS__), const_error())
  ------------------
  322|      0|	g->chunk_commit_data = chunk_start;
  323|      0|	return 0;
  324|      7|}
commit-graph.c:graph_data_width:
   79|      7|{
   80|      7|	return algop->rawsz + 16;
   81|      7|}

commit.c:init_buffer_slab:
   25|     60|scope void init_ ##slabname(struct slabname *s)				\
   26|     60|{									\
   27|     60|	init_ ##slabname## _with_stride(s, 1);				\
   28|     60|}									\

allocate_commit_buffer_slab:
  357|     60|{
  358|     60|	struct buffer_slab *bs = xmalloc(sizeof(*bs));
  359|     60|	init_buffer_slab(bs);
  360|     60|	return bs;
  361|     60|}
free_commit_buffer_slab:
  364|     60|{
  365|     60|	clear_buffer_slab(bs);
  366|     60|	free(bs);
  367|     60|}

commit-graph.c:get_be32:
  138|     60|{
  139|     60|	const unsigned char *p = ptr;
  140|     60|	return	(uint32_t)p[0] << 24 |
  141|     60|		(uint32_t)p[1] << 16 |
  142|     60|		(uint32_t)p[2] <<  8 |
  143|     60|		(uint32_t)p[3] <<  0;
  144|     60|}
chunk-format.c:get_be32:
  138|    718|{
  139|    718|	const unsigned char *p = ptr;
  140|    718|	return	(uint32_t)p[0] << 24 |
  141|    718|		(uint32_t)p[1] << 16 |
  142|    718|		(uint32_t)p[2] <<  8 |
  143|    718|		(uint32_t)p[3] <<  0;
  144|    718|}
chunk-format.c:get_be64:
  147|    271|{
  148|    271|	const unsigned char *p = ptr;
  149|    271|	return	(uint64_t)get_be32(&p[0]) << 32 |
  150|    271|		(uint64_t)get_be32(&p[4]) <<  0;
  151|    271|}

free_untracked_cache:
 3758|     60|{
 3759|     60|	if (!uc)
  ------------------
  |  Branch (3759:6): [True: 60, False: 0]
  ------------------
 3760|     60|		return;
 3761|       |
 3762|      0|	free(uc->exclude_per_dir_to_free);
 3763|      0|	strbuf_release(&uc->ident);
 3764|      0|	free_untracked(uc->root);
 3765|      0|	free(uc);
 3766|      0|}

repo_config_values_init:
  754|     60|{
  755|       |	/* section "core" config values */
  756|     60|	cfg->attributes_file = NULL;
  757|     60|	cfg->excludes_file = NULL;
  758|     60|	cfg->editor_program = NULL;
  759|     60|	cfg->pager_program = NULL;
  760|     60|	cfg->askpass_program = NULL;
  761|     60|	cfg->apply_default_whitespace = NULL;
  762|     60|	cfg->apply_default_ignorewhitespace = NULL;
  763|     60|	cfg->push_default = PUSH_DEFAULT_UNSPECIFIED;
  764|     60|	cfg->autorebase = AUTOREBASE_NEVER;
  765|     60|	cfg->object_creation_mode = OBJECT_CREATION_MODE;
  ------------------
  |  |   57|     60|#define OBJECT_CREATION_MODE OBJECT_CREATION_USES_HARDLINKS
  ------------------
  766|     60|	cfg->apply_sparse_checkout = 0;
  767|     60|	cfg->trust_ctime = 1;
  768|     60|	cfg->check_stat = 1;
  769|     60|	cfg->zlib_compression_level = Z_BEST_SPEED;
  ------------------
  |  |  195|     60|#define Z_BEST_SPEED             1
  ------------------
  770|     60|	cfg->pack_compression_level = Z_DEFAULT_COMPRESSION;
  ------------------
  |  |  197|     60|#define Z_DEFAULT_COMPRESSION  (-1)
  ------------------
  771|     60|	cfg->precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */
  772|     60|	cfg->core_sparse_checkout_cone = 0;
  773|     60|	cfg->warn_on_object_refname_ambiguity = 1;
  774|     60|	cfg->protect_hfs = PROTECT_HFS_DEFAULT;
  ------------------
  |  |   63|     60|#define PROTECT_HFS_DEFAULT 0
  ------------------
  775|     60|	cfg->protect_ntfs = PROTECT_NTFS_DEFAULT;
  ------------------
  |  |   67|     60|#define PROTECT_NTFS_DEFAULT 1
  ------------------
  776|     60|	cfg->ignore_case = 0;
  777|     60|	cfg->trust_executable_bit = 1;
  778|     60|	cfg->has_symlinks = platform_has_symlinks();
  ------------------
  |  |  249|     60|#define platform_has_symlinks() 1
  ------------------
  779|     60|	cfg->use_nanosec = 0;
  780|       |
  781|       |	/* section "sparse" config values */
  782|     60|	cfg->sparse_expect_files_outside_of_patterns = 0;
  783|       |
  784|       |	/* section "branch" config values */
  785|     60|	cfg->branch_track = BRANCH_TRACK_REMOTE;
  786|     60|}
repo_config_values_clear:
  789|     60|{
  790|     60|	FREE_AND_NULL(cfg->attributes_file);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  791|     60|	FREE_AND_NULL(cfg->excludes_file);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  792|     60|	FREE_AND_NULL(cfg->editor_program);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  793|     60|	FREE_AND_NULL(cfg->pager_program);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  794|     60|	FREE_AND_NULL(cfg->askpass_program);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  795|     60|	FREE_AND_NULL(cfg->apply_default_whitespace);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  796|       |	FREE_AND_NULL(cfg->apply_default_ignorewhitespace);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  797|     60|}

commit-graph.c:_:
   47|     61|{
   48|     61|	if (!*msgid)
  ------------------
  |  Branch (48:6): [True: 0, False: 61]
  ------------------
   49|      0|		return "";
   50|     61|	if (!git_gettext_enabled)
  ------------------
  |  Branch (50:6): [True: 61, False: 0]
  ------------------
   51|     61|		return msgid;
   52|      0|	return gettext(msgid);
   53|     61|}
usage.c:_:
   47|     86|{
   48|     86|	if (!*msgid)
  ------------------
  |  Branch (48:6): [True: 0, False: 86]
  ------------------
   49|      0|		return "";
   50|     86|	if (!git_gettext_enabled)
  ------------------
  |  Branch (50:6): [True: 86, False: 0]
  ------------------
   51|     86|		return msgid;
   52|      0|	return gettext(msgid);
   53|     86|}
chunk-format.c:_:
   47|     25|{
   48|     25|	if (!*msgid)
  ------------------
  |  Branch (48:6): [True: 0, False: 25]
  ------------------
   49|      0|		return "";
   50|     25|	if (!git_gettext_enabled)
  ------------------
  |  Branch (50:6): [True: 25, False: 0]
  ------------------
   51|     25|		return msgid;
   52|      0|	return gettext(msgid);
   53|     25|}

commit-graph.c:const_error:
  453|     61|{
  454|     61|	return -1;
  455|     61|}
remote.c:container_of_or_null_offset:
 1101|     60|{
 1102|     60|	return ptr ? (char *)ptr - offset : NULL;
  ------------------
  |  Branch (1102:9): [True: 0, False: 60]
  ------------------
 1103|     60|}
repository.c:st_mult:
  650|     60|{
  651|     60|	if (unsigned_mult_overflows(a, b))
  ------------------
  |  |  112|     60|    ((a) && (b) > maximum_unsigned_value_of_type(a) / (a))
  |  |  ------------------
  |  |  |  |   92|     60|    (UINTMAX_MAX >> (bitsizeof(uintmax_t) - bitsizeof(a)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   86|     60|#define bitsizeof(x)  (CHAR_BIT * sizeof(x))
  |  |  |  |  ------------------
  |  |  |  |                   (UINTMAX_MAX >> (bitsizeof(uintmax_t) - bitsizeof(a)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   86|     60|#define bitsizeof(x)  (CHAR_BIT * sizeof(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (112:6): [True: 60, False: 0]
  |  |  |  Branch (112:13): [True: 0, False: 60]
  |  |  ------------------
  ------------------
  652|      0|		die("size_t overflow: %"PRIuMAX" * %"PRIuMAX,
  653|      0|		    (uintmax_t)a, (uintmax_t)b);
  654|     60|	return a * b;
  655|     60|}
repository.c:container_of_or_null_offset:
 1101|    120|{
 1102|    120|	return ptr ? (char *)ptr - offset : NULL;
  ------------------
  |  Branch (1102:9): [True: 0, False: 120]
  ------------------
 1103|    120|}
strmap.c:container_of_or_null_offset:
 1101|    180|{
 1102|    180|	return ptr ? (char *)ptr - offset : NULL;
  ------------------
  |  Branch (1102:9): [True: 0, False: 180]
  ------------------
 1103|    180|}
chunk-format.c:st_mult:
  650|     46|{
  651|     46|	if (unsigned_mult_overflows(a, b))
  ------------------
  |  |  112|     46|    ((a) && (b) > maximum_unsigned_value_of_type(a) / (a))
  |  |  ------------------
  |  |  |  |   92|     46|    (UINTMAX_MAX >> (bitsizeof(uintmax_t) - bitsizeof(a)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   86|     46|#define bitsizeof(x)  (CHAR_BIT * sizeof(x))
  |  |  |  |  ------------------
  |  |  |  |                   (UINTMAX_MAX >> (bitsizeof(uintmax_t) - bitsizeof(a)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   86|     46|#define bitsizeof(x)  (CHAR_BIT * sizeof(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (112:6): [True: 46, False: 0]
  |  |  |  Branch (112:13): [True: 0, False: 46]
  |  |  ------------------
  ------------------
  652|      0|		die("size_t overflow: %"PRIuMAX" * %"PRIuMAX,
  653|      0|		    (uintmax_t)a, (uintmax_t)b);
  654|     46|	return a * b;
  655|     46|}
chunk-format.c:const_error:
  453|     25|{
  454|     25|	return -1;
  455|     25|}

chunk-format.c:hash_algo_by_ptr:
  386|     56|{
  387|     56|	size_t i;
  388|    112|	for (i = 0; i < GIT_HASH_NALGOS; i++) {
  ------------------
  |  |  193|    112|#define GIT_HASH_NALGOS (GIT_HASH_SHA256 + 1)
  |  |  ------------------
  |  |  |  |  191|    112|#define GIT_HASH_SHA256 2
  |  |  ------------------
  ------------------
  |  Branch (388:14): [True: 112, False: 0]
  ------------------
  389|    112|		const struct git_hash_algo *algop = &hash_algos[i];
  390|    112|		if (p == algop)
  ------------------
  |  Branch (390:7): [True: 56, False: 56]
  ------------------
  391|     56|			return i;
  392|    112|	}
  393|      0|	return GIT_HASH_UNKNOWN;
  ------------------
  |  |  187|      0|#define GIT_HASH_UNKNOWN 0
  ------------------
  394|     56|}

hashmap_init:
  155|    120|{
  156|    120|	unsigned int size = HASHMAP_INITIAL_SIZE;
  ------------------
  |  |   70|    120|#define HASHMAP_INITIAL_SIZE 64
  ------------------
  157|       |
  158|    120|	memset(map, 0, sizeof(*map));
  159|       |
  160|    120|	map->cmpfn = equals_function ? equals_function : always_equal;
  ------------------
  |  Branch (160:15): [True: 120, False: 0]
  ------------------
  161|    120|	map->cmpfn_data = cmpfn_data;
  162|       |
  163|       |	/* calculate initial table size and allocate the table */
  164|    120|	initial_size = (unsigned int) ((uint64_t) initial_size * 100
  165|    120|			/ HASHMAP_LOAD_FACTOR);
  ------------------
  |  |   74|    120|#define HASHMAP_LOAD_FACTOR 80
  ------------------
  166|    120|	while (initial_size > size)
  ------------------
  |  Branch (166:9): [True: 0, False: 120]
  ------------------
  167|      0|		size <<= HASHMAP_RESIZE_BITS;
  ------------------
  |  |   72|      0|#define HASHMAP_RESIZE_BITS 2
  ------------------
  168|    120|	alloc_table(map, size);
  169|       |
  170|       |	/*
  171|       |	 * Keep track of the number of items in the map and
  172|       |	 * allow the map to automatically grow as necessary.
  173|       |	 */
  174|    120|	map->do_count_items = 1;
  175|    120|}
hashmap_clear_:
  203|    300|{
  204|    300|	if (!map || !map->table)
  ------------------
  |  Branch (204:6): [True: 0, False: 300]
  |  Branch (204:14): [True: 180, False: 120]
  ------------------
  205|    180|		return;
  206|    120|	if (entry_offset >= 0)  /* called by hashmap_clear_and_free */
  ------------------
  |  Branch (206:6): [True: 60, False: 60]
  ------------------
  207|     60|		free_individual_entries(map, entry_offset);
  208|       |	FREE_AND_NULL(map->table);
  ------------------
  |  |  756|    120|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 120]
  |  |  ------------------
  ------------------
  209|    120|	map->tablesize = 0;
  210|    120|	map->private_size = 0;
  211|    120|}
hashmap_iter_init:
  289|    420|{
  290|    420|	iter->map = map;
  291|    420|	iter->tablepos = 0;
  292|       |	iter->next = NULL;
  293|    420|}
hashmap_iter_next:
  296|    420|{
  297|    420|	struct hashmap_entry *current = iter->next;
  298|  8.10k|	for (;;) {
  299|  8.10k|		if (current) {
  ------------------
  |  Branch (299:7): [True: 0, False: 8.10k]
  ------------------
  300|      0|			iter->next = current->next;
  301|      0|			return current;
  302|      0|		}
  303|       |
  304|  8.10k|		if (iter->tablepos >= iter->map->tablesize)
  ------------------
  |  Branch (304:7): [True: 420, False: 7.68k]
  ------------------
  305|    420|			return NULL;
  306|       |
  307|  7.68k|		current = iter->map->table[iter->tablepos++];
  308|  7.68k|	}
  309|    420|}
hashmap.c:alloc_table:
   77|    120|{
   78|    120|	map->tablesize = size;
   79|    120|	CALLOC_ARRAY(map->table, size);
  ------------------
  |  |  759|    120|#define CALLOC_ARRAY(x, alloc) (x) = xcalloc((alloc), sizeof(*(x)))
  ------------------
   80|       |
   81|       |	/* calculate resize thresholds for new size */
   82|    120|	map->grow_at = (unsigned int) ((uint64_t) size * HASHMAP_LOAD_FACTOR / 100);
  ------------------
  |  |   74|    120|#define HASHMAP_LOAD_FACTOR 80
  ------------------
   83|    120|	if (size <= HASHMAP_INITIAL_SIZE)
  ------------------
  |  |   70|    120|#define HASHMAP_INITIAL_SIZE 64
  ------------------
  |  Branch (83:6): [True: 120, False: 0]
  ------------------
   84|    120|		map->shrink_at = 0;
   85|      0|	else
   86|       |		/*
   87|       |		 * The shrink-threshold must be slightly smaller than
   88|       |		 * (grow-threshold / resize-factor) to prevent erratic resizing,
   89|       |		 * thus we divide by (resize-factor + 1).
   90|       |		 */
   91|      0|		map->shrink_at = map->grow_at / ((1 << HASHMAP_RESIZE_BITS) + 1);
  ------------------
  |  |   72|      0|#define HASHMAP_RESIZE_BITS 2
  ------------------
   92|    120|}
hashmap.c:free_individual_entries:
  178|     60|{
  179|     60|	struct hashmap_iter iter;
  180|     60|	struct hashmap_entry *e;
  181|       |
  182|     60|	hashmap_iter_init(map, &iter);
  183|     60|	while ((e = hashmap_iter_next(&iter)))
  ------------------
  |  Branch (183:9): [True: 0, False: 60]
  ------------------
  184|       |		/*
  185|       |		 * like container_of, but using caller-calculated
  186|       |		 * offset (caller being hashmap_clear_and_free)
  187|       |		 */
  188|      0|		free((char *)e - entry_offset);
  189|     60|}

remote.c:hashmap_iter_first:
  456|     60|{
  457|     60|	hashmap_iter_init(map, iter);
  458|     60|	return hashmap_iter_next(iter);
  459|     60|}
repository.c:hashmap_iter_first:
  456|    120|{
  457|    120|	hashmap_iter_init(map, iter);
  458|    120|	return hashmap_iter_next(iter);
  459|    120|}
strmap.c:hashmap_iter_first:
  456|    180|{
  457|    180|	hashmap_iter_init(map, iter);
  458|    180|	return hashmap_iter_next(iter);
  459|    180|}

free_name_hash:
  753|     60|{
  754|     60|	if (!istate->name_hash_initialized)
  ------------------
  |  Branch (754:6): [True: 60, False: 0]
  ------------------
  755|     60|		return;
  756|      0|	istate->name_hash_initialized = 0;
  757|       |
  758|      0|	hashmap_clear(&istate->name_hash);
  ------------------
  |  |  249|      0|#define hashmap_clear(map) hashmap_clear_(map, -1)
  ------------------
  759|       |	hashmap_clear_and_free(&istate->dir_hash, struct dir_entry, ent);
  ------------------
  |  |  268|      0|	hashmap_clear_(map, offsetof(type, member))
  ------------------
  760|      0|}

parsed_object_pool_new:
  555|     60|{
  556|     60|	struct parsed_object_pool *o = xmalloc(sizeof(*o));
  557|     60|	memset(o, 0, sizeof(*o));
  558|       |
  559|     60|	o->repo = repo;
  560|     60|	o->blob_state = alloc_state_alloc();
  561|     60|	o->tree_state = alloc_state_alloc();
  562|     60|	o->commit_state = alloc_state_alloc();
  563|     60|	o->tag_state = alloc_state_alloc();
  564|     60|	o->object_state = alloc_state_alloc();
  565|     60|	o->is_shallow = -1;
  566|     60|	CALLOC_ARRAY(o->shallow_stat, 1);
  ------------------
  |  |  759|     60|#define CALLOC_ARRAY(x, alloc) (x) = xcalloc((alloc), sizeof(*(x)))
  ------------------
  567|       |
  568|     60|	o->buffer_slab = allocate_commit_buffer_slab();
  569|       |
  570|     60|	return o;
  571|     60|}
parsed_object_pool_reset_commit_grafts:
  574|     60|{
  575|     60|	for (int i = 0; i < o->grafts_nr; i++) {
  ------------------
  |  Branch (575:18): [True: 0, False: 60]
  ------------------
  576|      0|		unparse_commit(o->repo, &o->grafts[i]->oid);
  577|      0|		free(o->grafts[i]);
  578|      0|	}
  579|     60|	o->grafts_nr = 0;
  580|     60|	o->commit_graft_prepared = 0;
  581|     60|}
parsed_object_pool_clear:
  584|     60|{
  585|       |	/*
  586|       |	 * As objects are allocated in slabs (see alloc.c), we do
  587|       |	 * not need to free each object, but each slab instead.
  588|       |	 *
  589|       |	 * Before doing so, we need to free any additional memory
  590|       |	 * the objects may hold.
  591|       |	 */
  592|     60|	unsigned i;
  593|       |
  594|     60|	for (i = 0; i < o->obj_hash_size; i++) {
  ------------------
  |  Branch (594:14): [True: 0, False: 60]
  ------------------
  595|      0|		struct object *obj = o->obj_hash[i];
  596|       |
  597|      0|		if (!obj)
  ------------------
  |  Branch (597:7): [True: 0, False: 0]
  ------------------
  598|      0|			continue;
  599|       |
  600|      0|		if (obj->type == OBJ_TREE)
  ------------------
  |  Branch (600:7): [True: 0, False: 0]
  ------------------
  601|      0|			free_tree_buffer((struct tree*)obj);
  602|      0|		else if (obj->type == OBJ_COMMIT)
  ------------------
  |  Branch (602:12): [True: 0, False: 0]
  ------------------
  603|      0|			release_commit_memory(o, (struct commit*)obj);
  604|      0|		else if (obj->type == OBJ_TAG)
  ------------------
  |  Branch (604:12): [True: 0, False: 0]
  ------------------
  605|      0|			release_tag_memory((struct tag*)obj);
  606|      0|	}
  607|       |
  608|     60|	FREE_AND_NULL(o->obj_hash);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  609|     60|	o->obj_hash_size = 0;
  610|       |
  611|     60|	free_commit_buffer_slab(o->buffer_slab);
  612|     60|	o->buffer_slab = NULL;
  613|       |
  614|     60|	parsed_object_pool_reset_commit_grafts(o);
  615|     60|	alloc_state_free_and_null(&o->blob_state);
  616|     60|	alloc_state_free_and_null(&o->tree_state);
  617|     60|	alloc_state_free_and_null(&o->commit_state);
  618|     60|	alloc_state_free_and_null(&o->tag_state);
  619|     60|	alloc_state_free_and_null(&o->object_state);
  620|     60|	stat_validity_clear(o->shallow_stat);
  621|       |	FREE_AND_NULL(o->shallow_stat);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  622|     60|}

odb_free:
 1110|     60|{
 1111|     60|	if (!o)
  ------------------
  |  Branch (1111:6): [True: 60, False: 0]
  ------------------
 1112|     60|		return;
 1113|       |
 1114|      0|	oidmap_clear(&o->replace_map, 1);
 1115|      0|	pthread_mutex_destroy(&o->replace_mutex);
 1116|       |
 1117|      0|	odb_close(o);
 1118|      0|	odb_free_sources(o);
 1119|       |
 1120|      0|	free(o);
 1121|      0|}

LLVMFuzzerTestOneInput:
   10|     60|{
   11|     60|	struct commit_graph *g;
   12|       |
   13|     60|	memset(the_repository, 0, sizeof(*the_repository));
   14|     60|	initialize_repository(the_repository);
   15|       |
   16|       |	/*
   17|       |	 * Initialize the_repository with commit-graph settings that would
   18|       |	 * normally be read from the repository's gitdir. We want to avoid
   19|       |	 * touching the disk to keep the individual fuzz-test cases as fast as
   20|       |	 * possible.
   21|       |	 */
   22|     60|	repo_set_hash_algo(the_repository, GIT_HASH_SHA1);
  ------------------
  |  |  189|     60|#define GIT_HASH_SHA1 1
  ------------------
   23|     60|	the_repository->settings.initialized = 1;
   24|     60|	the_repository->settings.commit_graph_generation_version = 2;
   25|     60|	the_repository->settings.commit_graph_changed_paths_version = 1;
   26|     60|	g = parse_commit_graph(the_repository, (void *)data, size);
   27|     60|	repo_clear(the_repository);
   28|     60|	free_commit_graph(g);
   29|       |
   30|     60|	return 0;
   31|     60|}

git_env_ulong:
  224|      1|{
  225|      1|	const char *v = getenv(k);
  226|      1|	if (v && !git_parse_ulong(v, &val))
  ------------------
  |  Branch (226:6): [True: 0, False: 1]
  |  Branch (226:11): [True: 0, False: 0]
  ------------------
  227|      0|		die(_("failed to parse %s"), k);
  228|      1|	return val;
  229|      1|}

index_state_init:
 2432|    120|{
 2433|    120|	struct index_state blank = INDEX_STATE_INIT(r);
  ------------------
  |  |  203|    120|#define INDEX_STATE_INIT(r) { \
  |  |  204|    120|	.repo = (r), \
  |  |  205|    120|}
  ------------------
 2434|    120|	memcpy(istate, &blank, sizeof(*istate));
 2435|    120|}
release_index:
 2438|     60|{
 2439|       |	/*
 2440|       |	 * Cache entries in istate->cache[] should have been allocated
 2441|       |	 * from the memory pool associated with this index, or from an
 2442|       |	 * associated split_index. There is no need to free individual
 2443|       |	 * cache entries. validate_cache_entries can detect when this
 2444|       |	 * assertion does not hold.
 2445|       |	 */
 2446|     60|	validate_cache_entries(istate);
 2447|       |
 2448|     60|	resolve_undo_clear_index(istate);
 2449|     60|	free_name_hash(istate);
 2450|     60|	cache_tree_free(&(istate->cache_tree));
 2451|     60|	free(istate->fsmonitor_last_update);
 2452|     60|	free(istate->cache);
 2453|     60|	discard_split_index(istate);
 2454|     60|	free_untracked_cache(istate->untracked);
 2455|       |
 2456|     60|	if (istate->sparse_checkout_patterns) {
  ------------------
  |  Branch (2456:6): [True: 0, False: 60]
  ------------------
 2457|      0|		clear_pattern_list(istate->sparse_checkout_patterns);
 2458|      0|		FREE_AND_NULL(istate->sparse_checkout_patterns);
  ------------------
  |  |  756|      0|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2459|      0|	}
 2460|       |
 2461|     60|	if (istate->ce_mem_pool) {
  ------------------
  |  Branch (2461:6): [True: 0, False: 60]
  ------------------
 2462|      0|		mem_pool_discard(istate->ce_mem_pool, should_validate_cache_entries());
 2463|       |		FREE_AND_NULL(istate->ce_mem_pool);
  ------------------
  |  |  756|      0|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2464|      0|	}
 2465|     60|}
discard_index:
 2468|     60|{
 2469|     60|	release_index(istate);
 2470|     60|	index_state_init(istate, istate->repo);
 2471|     60|}
validate_cache_entries:
 2481|     60|{
 2482|     60|	int i;
 2483|       |
 2484|     60|	if (!should_validate_cache_entries() ||!istate || !istate->initialized)
  ------------------
  |  Branch (2484:6): [True: 60, False: 0]
  |  Branch (2484:41): [True: 0, False: 0]
  |  Branch (2484:52): [True: 0, False: 0]
  ------------------
 2485|     60|		return;
 2486|       |
 2487|      0|	for (i = 0; i < istate->cache_nr; i++) {
  ------------------
  |  Branch (2487:14): [True: 0, False: 0]
  ------------------
 2488|      0|		if (!istate) {
  ------------------
  |  Branch (2488:7): [True: 0, False: 0]
  ------------------
 2489|      0|			BUG("cache entry is not allocated from expected memory pool");
  ------------------
  |  | 1033|      0|#define BUG(...) BUG_fl(__FILE__, __LINE__, __VA_ARGS__)
  ------------------
 2490|      0|		} else if (!istate->ce_mem_pool ||
  ------------------
  |  Branch (2490:14): [True: 0, False: 0]
  ------------------
 2491|      0|			!mem_pool_contains(istate->ce_mem_pool, istate->cache[i])) {
  ------------------
  |  Branch (2491:4): [True: 0, False: 0]
  ------------------
 2492|      0|			if (!istate->split_index ||
  ------------------
  |  Branch (2492:8): [True: 0, False: 0]
  ------------------
 2493|      0|				!istate->split_index->base ||
  ------------------
  |  Branch (2493:5): [True: 0, False: 0]
  ------------------
 2494|      0|				!istate->split_index->base->ce_mem_pool ||
  ------------------
  |  Branch (2494:5): [True: 0, False: 0]
  ------------------
 2495|      0|				!mem_pool_contains(istate->split_index->base->ce_mem_pool, istate->cache[i])) {
  ------------------
  |  Branch (2495:5): [True: 0, False: 0]
  ------------------
 2496|      0|				BUG("cache entry is not allocated from expected memory pool");
  ------------------
  |  | 1033|      0|#define BUG(...) BUG_fl(__FILE__, __LINE__, __VA_ARGS__)
  ------------------
 2497|      0|			}
 2498|      0|		}
 2499|      0|	}
 2500|       |
 2501|      0|	if (istate->split_index)
  ------------------
  |  Branch (2501:6): [True: 0, False: 0]
  ------------------
 2502|      0|		validate_cache_entries(istate->split_index->base);
 2503|      0|}
should_validate_cache_entries:
 3543|     60|{
 3544|     60|	static int validate_index_cache_entries = -1;
 3545|       |
 3546|     60|	if (validate_index_cache_entries < 0) {
  ------------------
  |  Branch (3546:6): [True: 1, False: 59]
  ------------------
 3547|      1|		if (getenv("GIT_TEST_VALIDATE_INDEX_CACHE_ENTRIES"))
  ------------------
  |  Branch (3547:7): [True: 0, False: 1]
  ------------------
 3548|      0|			validate_index_cache_entries = 1;
 3549|      1|		else
 3550|      1|			validate_index_cache_entries = 0;
 3551|      1|	}
 3552|       |
 3553|     60|	return validate_index_cache_entries;
 3554|     60|}

remote_state_new:
 2966|     60|{
 2967|     60|	struct remote_state *r;
 2968|       |
 2969|     60|	CALLOC_ARRAY(r, 1);
  ------------------
  |  |  759|     60|#define CALLOC_ARRAY(x, alloc) (x) = xcalloc((alloc), sizeof(*(x)))
  ------------------
 2970|       |
 2971|     60|	hashmap_init(&r->remotes_hash, remotes_hash_cmp, NULL, 0);
 2972|       |	hashmap_init(&r->branches_hash, branches_hash_cmp, NULL, 0);
 2973|     60|	return r;
 2974|     60|}
remote_state_clear:
 2977|     60|{
 2978|     60|	struct hashmap_iter iter;
 2979|     60|	struct branch *b;
 2980|     60|	int i;
 2981|       |
 2982|     60|	for (i = 0; i < remote_state->remotes_nr; i++)
  ------------------
  |  Branch (2982:14): [True: 0, False: 60]
  ------------------
 2983|      0|		remote_clear(remote_state->remotes[i]);
 2984|     60|	FREE_AND_NULL(remote_state->remotes);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
 2985|     60|	FREE_AND_NULL(remote_state->pushremote_name);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
 2986|     60|	remote_state->remotes_alloc = 0;
 2987|     60|	remote_state->remotes_nr = 0;
 2988|       |
 2989|     60|	rewrites_release(&remote_state->rewrites);
 2990|     60|	rewrites_release(&remote_state->rewrites_push);
 2991|       |
 2992|     60|	hashmap_clear_and_free(&remote_state->remotes_hash, struct remote, ent);
  ------------------
  |  |  268|     60|	hashmap_clear_(map, offsetof(type, member))
  ------------------
 2993|     60|	hashmap_for_each_entry(&remote_state->branches_hash, &iter, b, ent) {
  ------------------
  |  |  482|     60|	for (var = NULL, /* for systems without typeof */ \
  |  |  483|     60|	     var = hashmap_iter_first_entry_offset(map, iter, \
  |  |  ------------------
  |  |  |  |  475|     60|	container_of_or_null_offset(hashmap_iter_first(map, iter), offset)
  |  |  ------------------
  |  |  484|     60|						OFFSETOF_VAR(var, member)); \
  |  |  485|     60|		var; \
  |  |  ------------------
  |  |  |  Branch (485:3): [True: 0, False: 60]
  |  |  ------------------
  |  |  486|     60|		var = hashmap_iter_next_entry_offset(iter, \
  |  |  ------------------
  |  |  |  |  471|      0|	container_of_or_null_offset(hashmap_iter_next(iter), offset)
  |  |  ------------------
  |  |  487|     60|						OFFSETOF_VAR(var, member)))
  ------------------
 2994|      0|		branch_release(b);
 2995|      0|		free(b);
 2996|      0|	}
 2997|     60|	hashmap_clear(&remote_state->branches_hash);
  ------------------
  |  |  249|     60|#define hashmap_clear(map) hashmap_clear_(map, -1)
  ------------------
 2998|     60|}
remote.c:rewrites_release:
  311|    120|{
  312|    120|	for (int i = 0; i < r->rewrite_nr; i++) {
  ------------------
  |  Branch (312:18): [True: 0, False: 120]
  ------------------
  313|      0|		struct rewrite *rewrite = r->rewrite[i];
  314|       |
  315|      0|		free((char *)rewrite->base);
  316|      0|		for (int j = 0; j < rewrite->instead_of_nr; j++)
  ------------------
  |  Branch (316:19): [True: 0, False: 0]
  ------------------
  317|      0|			free((char *)rewrite->instead_of[j].s);
  318|      0|		free(rewrite->instead_of);
  319|      0|		free(rewrite);
  320|      0|	}
  321|    120|	free(r->rewrite);
  322|    120|	memset(r, 0, sizeof(*r));
  323|    120|}

repo_settings_clear:
  160|     60|{
  161|     60|	struct repo_settings empty = REPO_SETTINGS_INIT;
  ------------------
  |  |   67|     60|#define REPO_SETTINGS_INIT { \
  |  |   68|     60|	.shared_repository = -1, \
  |  |   69|     60|	.index_version = -1, \
  |  |   70|     60|	.core_untracked_cache = UNTRACKED_CACHE_KEEP, \
  |  |   71|     60|	.fetch_negotiation_algorithm = FETCH_NEGOTIATION_CONSECUTIVE, \
  |  |   72|     60|	.warn_ambiguous_refs = -1, \
  |  |   73|     60|	.delta_base_cache_limit = DEFAULT_DELTA_BASE_CACHE_LIMIT, \
  |  |  ------------------
  |  |  |  |   12|     60|#define DEFAULT_DELTA_BASE_CACHE_LIMIT (96 * 1024 * 1024)
  |  |  ------------------
  |  |   74|     60|	.packed_git_window_size = DEFAULT_PACKED_GIT_WINDOW_SIZE, \
  |  |  ------------------
  |  |  |  |  579|     60|	(sizeof(void*) >= 8 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (579:3): [True: 0, Folded]
  |  |  |  |  ------------------
  |  |  |  |  580|     60|		?  1 * 1024 * 1024 * 1024 \
  |  |  |  |  581|     60|		: 32 * 1024 * 1024)
  |  |  ------------------
  |  |   75|     60|	.packed_git_limit = DEFAULT_PACKED_GIT_LIMIT, \
  |  |  ------------------
  |  |  |  |  592|     60|	((1024L * 1024L) * (size_t)(sizeof(void*) >= 8 ? (32 * 1024L * 1024L) : 256))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (592:30): [True: 0, Folded]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   76|     60|	.max_allowed_tree_depth = DEFAULT_MAX_ALLOWED_TREE_DEPTH, \
  |  |  ------------------
  |  |  |  |  615|     60|#define DEFAULT_MAX_ALLOWED_TREE_DEPTH 2048
  |  |  ------------------
  |  |   77|     60|}
  ------------------
  162|     60|	FREE_AND_NULL(r->settings.fsmonitor);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  163|       |	FREE_AND_NULL(r->settings.hooks_path);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  164|     60|	r->settings = empty;
  165|     60|}

initialize_repository:
   66|     60|{
   67|     60|	if (repo->initialized)
  ------------------
  |  Branch (67:6): [True: 0, False: 60]
  ------------------
   68|      0|		BUG("repository initialized already");
  ------------------
  |  | 1033|      0|#define BUG(...) BUG_fl(__FILE__, __LINE__, __VA_ARGS__)
  ------------------
   69|     60|	repo->initialized = true;
   70|       |
   71|     60|	repo->remote_state = remote_state_new();
   72|     60|	repo->parsed_objects = parsed_object_pool_new(repo);
   73|     60|	ALLOC_ARRAY(repo->index, 1);
  ------------------
  |  |  758|     60|#define ALLOC_ARRAY(x, alloc) (x) = xmalloc(st_mult(sizeof(*(x)), (alloc)))
  ------------------
   74|     60|	index_state_init(repo->index, repo);
   75|     60|	repo->check_deprecated_config = true;
   76|     60|	repo->bare_cfg = -1;
   77|     60|	repo->fetch_if_missing = 1;
   78|     60|	repo_config_values_init(&repo->config_values_private_);
   79|       |
   80|       |	/*
   81|       |	 * When a command runs inside a repository, it learns what
   82|       |	 * hash algorithm is in use from the repository, but some
   83|       |	 * commands are designed to work outside a repository, yet
   84|       |	 * they want to access the_hash_algo, if only for the length
   85|       |	 * of the hashed value to see if their input looks like a
   86|       |	 * plausible hash value.
   87|       |	 *
   88|       |	 * We are in the process of identifying such code paths and
   89|       |	 * giving them an appropriate default individually; any
   90|       |	 * unconverted code paths that try to access the_hash_algo
   91|       |	 * will thus fail.  The end-users however have an escape hatch
   92|       |	 * to set GIT_TEST_DEFAULT_HASH_ALGO environment variable to
   93|       |	 * "sha1" to get back the old behaviour of defaulting to SHA-1.
   94|       |	 *
   95|       |	 * This escape hatch is deliberately kept unadvertised, so
   96|       |	 * that they see crashes and we can get a report before
   97|       |	 * telling them about it.
   98|       |	 */
   99|     60|	if (repo == the_repository)
  ------------------
  |  Branch (99:6): [True: 60, False: 0]
  ------------------
  100|     60|		set_default_hash_algo(repo);
  101|     60|}
repo_set_hash_algo:
  195|     60|{
  196|     60|	repo->hash_algo = &hash_algos[hash_algo];
  197|     60|}
repo_clear:
  373|     60|{
  374|     60|	struct hashmap_iter iter;
  375|     60|	struct strmap_entry *e;
  376|       |
  377|     60|	FREE_AND_NULL(repo->gitdir);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  378|     60|	FREE_AND_NULL(repo->commondir);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  379|     60|	FREE_AND_NULL(repo->prefix);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  380|     60|	FREE_AND_NULL(repo->graft_file);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  381|     60|	FREE_AND_NULL(repo->index_file);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  382|     60|	FREE_AND_NULL(repo->worktree);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  383|     60|	FREE_AND_NULL(repo->submodule_prefix);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  384|     60|	FREE_AND_NULL(repo->ref_storage_payload);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  385|       |
  386|     60|	odb_free(repo->objects);
  387|     60|	repo->objects = NULL;
  388|       |
  389|     60|	if (repo->parsed_objects)
  ------------------
  |  Branch (389:6): [True: 60, False: 0]
  ------------------
  390|     60|		parsed_object_pool_clear(repo->parsed_objects);
  391|     60|	FREE_AND_NULL(repo->parsed_objects);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  392|       |
  393|     60|	repo_settings_clear(repo);
  394|     60|	repo_config_values_clear(&repo->config_values_private_);
  395|       |
  396|     60|	if (repo->config) {
  ------------------
  |  Branch (396:6): [True: 0, False: 60]
  ------------------
  397|      0|		git_configset_clear(repo->config);
  398|      0|		FREE_AND_NULL(repo->config);
  ------------------
  |  |  756|      0|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
  399|      0|	}
  400|       |
  401|     60|	if (repo->submodule_cache) {
  ------------------
  |  Branch (401:6): [True: 0, False: 60]
  ------------------
  402|      0|		submodule_cache_free(repo->submodule_cache);
  403|      0|		repo->submodule_cache = NULL;
  404|      0|	}
  405|       |
  406|     60|	if (repo->index) {
  ------------------
  |  Branch (406:6): [True: 60, False: 0]
  ------------------
  407|     60|		discard_index(repo->index);
  408|     60|		FREE_AND_NULL(repo->index);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  409|     60|	}
  410|       |
  411|     60|	if (repo->hook_config_cache) {
  ------------------
  |  Branch (411:6): [True: 0, False: 60]
  ------------------
  412|      0|		hook_cache_clear(repo->hook_config_cache);
  413|      0|		FREE_AND_NULL(repo->hook_config_cache);
  ------------------
  |  |  756|      0|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
  414|      0|	}
  415|     60|	strmap_clear(&repo->event_jobs, 0); /* values are uintptr_t, not heap ptrs */
  416|     60|	string_list_clear(&repo->disabled_events, 0);
  417|       |
  418|     60|	if (repo->promisor_remote_config) {
  ------------------
  |  Branch (418:6): [True: 0, False: 60]
  ------------------
  419|      0|		promisor_remote_clear(repo->promisor_remote_config);
  420|      0|		FREE_AND_NULL(repo->promisor_remote_config);
  ------------------
  |  |  756|      0|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
  421|      0|	}
  422|       |
  423|     60|	if (repo->remote_state) {
  ------------------
  |  Branch (423:6): [True: 60, False: 0]
  ------------------
  424|     60|		remote_state_clear(repo->remote_state);
  425|     60|		FREE_AND_NULL(repo->remote_state);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  426|     60|	}
  427|       |
  428|     60|	if (repo->refs_private) {
  ------------------
  |  Branch (428:6): [True: 0, False: 60]
  ------------------
  429|      0|		ref_store_release(repo->refs_private);
  430|      0|		FREE_AND_NULL(repo->refs_private);
  ------------------
  |  |  756|      0|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
  431|      0|	}
  432|       |
  433|     60|	strmap_for_each_entry(&repo->submodule_ref_stores, &iter, e)
  ------------------
  |  |  112|     60|	hashmap_for_each_entry(&(mystrmap)->map, iter, var, ent)
  |  |  ------------------
  |  |  |  |  482|     60|	for (var = NULL, /* for systems without typeof */ \
  |  |  |  |  483|     60|	     var = hashmap_iter_first_entry_offset(map, iter, \
  |  |  |  |  ------------------
  |  |  |  |  |  |  475|     60|	container_of_or_null_offset(hashmap_iter_first(map, iter), offset)
  |  |  |  |  ------------------
  |  |  |  |  484|     60|						OFFSETOF_VAR(var, member)); \
  |  |  |  |  485|     60|		var; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (485:3): [True: 0, False: 60]
  |  |  |  |  ------------------
  |  |  |  |  486|     60|		var = hashmap_iter_next_entry_offset(iter, \
  |  |  |  |  ------------------
  |  |  |  |  |  |  471|      0|	container_of_or_null_offset(hashmap_iter_next(iter), offset)
  |  |  |  |  ------------------
  |  |  |  |  487|     60|						OFFSETOF_VAR(var, member)))
  |  |  ------------------
  ------------------
  434|      0|		ref_store_release(e->value);
  435|     60|	strmap_clear(&repo->submodule_ref_stores, 1);
  436|       |
  437|     60|	strmap_for_each_entry(&repo->worktree_ref_stores, &iter, e)
  ------------------
  |  |  112|     60|	hashmap_for_each_entry(&(mystrmap)->map, iter, var, ent)
  |  |  ------------------
  |  |  |  |  482|     60|	for (var = NULL, /* for systems without typeof */ \
  |  |  |  |  483|     60|	     var = hashmap_iter_first_entry_offset(map, iter, \
  |  |  |  |  ------------------
  |  |  |  |  |  |  475|     60|	container_of_or_null_offset(hashmap_iter_first(map, iter), offset)
  |  |  |  |  ------------------
  |  |  |  |  484|     60|						OFFSETOF_VAR(var, member)); \
  |  |  |  |  485|     60|		var; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (485:3): [True: 0, False: 60]
  |  |  |  |  ------------------
  |  |  |  |  486|     60|		var = hashmap_iter_next_entry_offset(iter, \
  |  |  |  |  ------------------
  |  |  |  |  |  |  471|      0|	container_of_or_null_offset(hashmap_iter_next(iter), offset)
  |  |  |  |  ------------------
  |  |  |  |  487|     60|						OFFSETOF_VAR(var, member)))
  |  |  ------------------
  ------------------
  438|      0|		ref_store_release(e->value);
  439|     60|	strmap_clear(&repo->worktree_ref_stores, 1);
  440|       |
  441|     60|	repo_clear_path_cache(&repo->cached_paths);
  442|     60|}
repository.c:set_default_hash_algo:
   42|     60|{
   43|     60|	const char *hash_name;
   44|     60|	uint32_t algo;
   45|       |
   46|     60|	hash_name = getenv("GIT_TEST_DEFAULT_HASH_ALGO");
   47|     60|	if (!hash_name)
  ------------------
  |  Branch (47:6): [True: 60, False: 0]
  ------------------
   48|     60|		return;
   49|      0|	algo = hash_algo_by_name(hash_name);
   50|      0|	if (algo == GIT_HASH_UNKNOWN)
  ------------------
  |  |  187|      0|#define GIT_HASH_UNKNOWN 0
  ------------------
  |  Branch (50:6): [True: 0, False: 0]
  ------------------
   51|      0|		return;
   52|       |
   53|      0|	repo_set_hash_algo(repo, algo);
   54|      0|}
repository.c:repo_clear_path_cache:
  362|     60|{
  363|     60|	FREE_AND_NULL(cache->squash_msg);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  364|     60|	FREE_AND_NULL(cache->merge_msg);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  365|     60|	FREE_AND_NULL(cache->merge_rr);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  366|     60|	FREE_AND_NULL(cache->merge_mode);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  367|     60|	FREE_AND_NULL(cache->merge_head);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  368|     60|	FREE_AND_NULL(cache->fetch_head);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  369|       |	FREE_AND_NULL(cache->shallow);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  370|     60|}

resolve_undo_clear_index:
  114|     60|{
  115|     60|	struct string_list *resolve_undo = istate->resolve_undo;
  116|     60|	if (!resolve_undo)
  ------------------
  |  Branch (116:6): [True: 60, False: 0]
  ------------------
  117|     60|		return;
  118|      0|	string_list_clear(resolve_undo, 1);
  119|      0|	free(resolve_undo);
  120|      0|	istate->resolve_undo = NULL;
  121|      0|	istate->cache_changed |= RESOLVE_UNDO_CHANGED;
  ------------------
  |  |  132|      0|#define RESOLVE_UNDO_CHANGED	(1 << 4)
  ------------------
  122|      0|}

discard_split_index:
  410|     60|{
  411|     60|	struct split_index *si = istate->split_index;
  412|     60|	if (!si)
  ------------------
  |  Branch (412:6): [True: 60, False: 0]
  ------------------
  413|     60|		return;
  414|      0|	istate->split_index = NULL;
  415|      0|	si->refcount--;
  416|      0|	if (si->refcount)
  ------------------
  |  Branch (416:6): [True: 0, False: 0]
  ------------------
  417|      0|		return;
  418|      0|	if (si->base) {
  ------------------
  |  Branch (418:6): [True: 0, False: 0]
  ------------------
  419|      0|		discard_index(si->base);
  420|      0|		free(si->base);
  421|      0|	}
  422|      0|	free(si);
  423|      0|}

stat_validity_clear:
  108|     60|{
  109|       |	FREE_AND_NULL(sv->sd);
  ------------------
  |  |  756|     60|#define FREE_AND_NULL(p) do { free(p); (p) = NULL; } while (0)
  |  |  ------------------
  |  |  |  Branch (756:61): [Folded, False: 60]
  |  |  ------------------
  ------------------
  110|     60|}

string_list_clear:
  165|     60|{
  166|     60|	if (list->items) {
  ------------------
  |  Branch (166:6): [True: 0, False: 60]
  ------------------
  167|      0|		if (list->strdup_strings) {
  ------------------
  |  Branch (167:7): [True: 0, False: 0]
  ------------------
  168|      0|			for (size_t i = 0; i < list->nr; i++)
  ------------------
  |  Branch (168:23): [True: 0, False: 0]
  ------------------
  169|      0|				free(list->items[i].string);
  170|      0|		}
  171|      0|		if (free_util) {
  ------------------
  |  Branch (171:7): [True: 0, False: 0]
  ------------------
  172|      0|			for (size_t i = 0; i < list->nr; i++)
  ------------------
  |  Branch (172:23): [True: 0, False: 0]
  ------------------
  173|      0|				free(list->items[i].util);
  174|      0|		}
  175|      0|		free(list->items);
  176|      0|	}
  177|       |	list->items = NULL;
  178|     60|	list->nr = list->alloc = 0;
  179|     60|}

strmap_clear:
   69|    180|{
   70|    180|	strmap_free_entries_(map, free_values);
   71|    180|	hashmap_clear(&map->map);
  ------------------
  |  |  249|    180|#define hashmap_clear(map) hashmap_clear_(map, -1)
  ------------------
   72|    180|}
strmap.c:strmap_free_entries_:
   42|    180|{
   43|    180|	struct hashmap_iter iter;
   44|    180|	struct strmap_entry *e;
   45|       |
   46|    180|	if (!map)
  ------------------
  |  Branch (46:6): [True: 0, False: 180]
  ------------------
   47|      0|		return;
   48|       |
   49|    180|	if (!free_values && map->pool)
  ------------------
  |  Branch (49:6): [True: 60, False: 120]
  |  Branch (49:22): [True: 0, False: 60]
  ------------------
   50|       |		/* Memory other than util is owned by and freed with the pool */
   51|      0|		return;
   52|       |
   53|       |	/*
   54|       |	 * We need to iterate over the hashmap entries and free
   55|       |	 * e->key and e->value ourselves; hashmap has no API to
   56|       |	 * take care of that for us.  Since we're already iterating over
   57|       |	 * the hashmap, though, might as well free e too and avoid the need
   58|       |	 * to make some call into the hashmap API to do that.
   59|       |	 */
   60|    180|	hashmap_for_each_entry(&map->map, &iter, e, ent) {
  ------------------
  |  |  482|    180|	for (var = NULL, /* for systems without typeof */ \
  |  |  483|    180|	     var = hashmap_iter_first_entry_offset(map, iter, \
  |  |  ------------------
  |  |  |  |  475|    180|	container_of_or_null_offset(hashmap_iter_first(map, iter), offset)
  |  |  ------------------
  |  |  484|    180|						OFFSETOF_VAR(var, member)); \
  |  |  485|    180|		var; \
  |  |  ------------------
  |  |  |  Branch (485:3): [True: 0, False: 180]
  |  |  ------------------
  |  |  486|    180|		var = hashmap_iter_next_entry_offset(iter, \
  |  |  ------------------
  |  |  |  |  471|      0|	container_of_or_null_offset(hashmap_iter_next(iter), offset)
  |  |  ------------------
  |  |  487|    180|						OFFSETOF_VAR(var, member)))
  ------------------
   61|      0|		if (free_values)
  ------------------
  |  Branch (61:7): [True: 0, False: 0]
  ------------------
   62|      0|			free(e->value);
   63|      0|		if (!map->pool)
  ------------------
  |  Branch (63:7): [True: 0, False: 0]
  ------------------
   64|      0|			free(e);
   65|      0|	}
   66|    180|}

trace2_cmd_error_va_fl:
  381|     86|{
  382|     86|	struct tr2_tgt *tgt_j;
  383|     86|	int j;
  384|       |
  385|     86|	if (!trace2_enabled)
  ------------------
  |  Branch (385:6): [True: 86, False: 0]
  ------------------
  386|     86|		return;
  387|       |
  388|       |	/*
  389|       |	 * We expect each target function to treat 'ap' as constant
  390|       |	 * and use va_copy (because an 'ap' can only be walked once).
  391|       |	 */
  392|     86|	for_each_wanted_builtin (j, tgt_j)
  ------------------
  |  |   52|      0|	for_each_builtin(j, tgt_j)                   \
  |  |  ------------------
  |  |  |  |   45|      0|	for (j = 0, tgt_j = tr2_tgt_builtins[j];	\
  |  |  |  |   46|      0|	     tgt_j;					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (46:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   47|      0|	     j++, tgt_j = tr2_tgt_builtins[j])
  |  |  ------------------
  |  |   53|      0|		if (tr2_dst_trace_want(tgt_j->pdst))
  |  |  ------------------
  |  |  |  Branch (53:7): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  393|      0|		if (tgt_j->pfn_error_va_fl)
  ------------------
  |  Branch (393:7): [True: 0, False: 0]
  ------------------
  394|      0|			tgt_j->pfn_error_va_fl(file, line, fmt, ap);
  395|      0|}

error:
  292|     86|{
  293|     86|	va_list params;
  294|       |
  295|     86|	va_start(params, err);
  296|     86|	error_routine(err, params);
  297|       |	va_end(params);
  298|     86|	return -1;
  299|     86|}
usage.c:vreportf:
   41|     86|{
   42|       |	vfreportf(stderr, prefix, err, params);
   43|     86|}
usage.c:vfreportf:
   13|     86|{
   14|     86|	char msg[4096];
   15|     86|	char *p, *pend = msg + sizeof(msg);
   16|     86|	size_t prefix_len = strlen(prefix);
   17|       |
   18|     86|	if (sizeof(msg) <= prefix_len) {
  ------------------
  |  Branch (18:6): [True: 0, False: 86]
  ------------------
   19|      0|		fprintf(stderr, "BUG!!! too long a prefix '%s'\n", prefix);
   20|      0|		abort();
   21|      0|	}
   22|     86|	memcpy(msg, prefix, prefix_len);
   23|     86|	p = msg + prefix_len;
   24|     86|	if (vsnprintf(p, pend - p, err, params) < 0) {
  ------------------
  |  Branch (24:6): [True: 0, False: 86]
  ------------------
   25|      0|		fprintf(stderr, _("error: unable to format message: %s\n"),
   26|      0|			err);
   27|      0|		*p = '\0'; /* vsnprintf() failed, clip at prefix */
   28|      0|	}
   29|       |
   30|  4.44k|	for (; p != pend - 1 && *p; p++) {
  ------------------
  |  Branch (30:9): [True: 4.44k, False: 0]
  |  Branch (30:26): [True: 4.35k, False: 86]
  ------------------
   31|  4.35k|		if (iscntrl(*p) && *p != '\t' && *p != '\n')
  ------------------
  |  |   49|  8.71k|#define iscntrl(x) (sane_istest(x,GIT_CNTRL))
  |  |  ------------------
  |  |  |  |   38|  4.35k|#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
  |  |  ------------------
  |  |  |  Branch (49:20): [True: 0, False: 4.35k]
  |  |  ------------------
  ------------------
  |  Branch (31:22): [True: 0, False: 0]
  |  Branch (31:36): [True: 0, False: 0]
  ------------------
   32|      0|			*p = '?';
   33|  4.35k|	}
   34|       |
   35|     86|	*(p++) = '\n'; /* we no longer need a NUL */
   36|     86|	fflush(f);
   37|     86|	write_in_full(fileno(f), msg, p - msg);
   38|     86|}
usage.c:error_builtin:
   91|     86|{
   92|     86|	trace2_cmd_error_va(err, params);
  ------------------
  |  |  119|     86|	trace2_cmd_error_va_fl(__FILE__, __LINE__, (fmt), (ap))
  ------------------
   93|       |
   94|     86|	vreportf(_("error: "), err, params);
   95|     86|}

xmalloc:
   75|    180|{
   76|    180|	return do_xmalloc(size, 0);
   77|    180|}
xrealloc:
  131|     46|{
  132|     46|	void *ret;
  133|       |
  134|     46|	if (!size) {
  ------------------
  |  Branch (134:6): [True: 0, False: 46]
  ------------------
  135|      0|		free(ptr);
  136|      0|		return xmalloc(0);
  137|      0|	}
  138|       |
  139|     46|	memory_limit_check(size, 0);
  140|     46|	ret = realloc(ptr, size);
  141|     46|	if (!ret)
  ------------------
  |  Branch (141:6): [True: 0, False: 46]
  ------------------
  142|      0|		die("Out of memory, realloc failed");
  143|     46|	return ret;
  144|     46|}
xcalloc:
  147|    651|{
  148|    651|	void *ret;
  149|       |
  150|    651|	if (unsigned_mult_overflows(nmemb, size))
  ------------------
  |  |  112|    651|    ((a) && (b) > maximum_unsigned_value_of_type(a) / (a))
  |  |  ------------------
  |  |  |  |   92|    651|    (UINTMAX_MAX >> (bitsizeof(uintmax_t) - bitsizeof(a)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   86|    651|#define bitsizeof(x)  (CHAR_BIT * sizeof(x))
  |  |  |  |  ------------------
  |  |  |  |                   (UINTMAX_MAX >> (bitsizeof(uintmax_t) - bitsizeof(a)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   86|    651|#define bitsizeof(x)  (CHAR_BIT * sizeof(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (112:6): [True: 651, False: 0]
  |  |  |  Branch (112:13): [True: 0, False: 651]
  |  |  ------------------
  ------------------
  151|      0|		die("data too large to fit into virtual memory space");
  152|       |
  153|    651|	memory_limit_check(size * nmemb, 0);
  154|    651|	ret = calloc(nmemb, size);
  155|    651|	if (!ret && (!nmemb || !size))
  ------------------
  |  Branch (155:6): [True: 0, False: 651]
  |  Branch (155:15): [True: 0, False: 0]
  |  Branch (155:25): [True: 0, False: 0]
  ------------------
  156|      0|		ret = calloc(1, 1);
  157|    651|	if (!ret)
  ------------------
  |  Branch (157:6): [True: 0, False: 651]
  ------------------
  158|      0|		die("Out of memory, calloc failed");
  159|    651|	return ret;
  160|    651|}
xwrite:
  251|     86|{
  252|     86|	ssize_t nr;
  253|     86|	if (len > MAX_IO_SIZE)
  ------------------
  |  |  733|     86|#  define MAX_IO_SIZE MAX_IO_SIZE_DEFAULT
  |  |  ------------------
  |  |  |  |  729|     86|# define MAX_IO_SIZE_DEFAULT (8*1024*1024)
  |  |  ------------------
  ------------------
  |  Branch (253:6): [True: 0, False: 86]
  ------------------
  254|      0|		len = MAX_IO_SIZE;
  ------------------
  |  |  733|      0|#  define MAX_IO_SIZE MAX_IO_SIZE_DEFAULT
  |  |  ------------------
  |  |  |  |  729|      0|# define MAX_IO_SIZE_DEFAULT (8*1024*1024)
  |  |  ------------------
  ------------------
  255|     86|	while (1) {
  ------------------
  |  Branch (255:9): [True: 86, Folded]
  ------------------
  256|     86|		nr = write(fd, buf, len);
  257|     86|		if (nr < 0) {
  ------------------
  |  Branch (257:7): [True: 0, False: 86]
  ------------------
  258|      0|			if (errno == EINTR)
  ------------------
  |  Branch (258:8): [True: 0, False: 0]
  ------------------
  259|      0|				continue;
  260|      0|			if (handle_nonblock(fd, POLLOUT, errno))
  ------------------
  |  Branch (260:8): [True: 0, False: 0]
  ------------------
  261|      0|				continue;
  262|      0|		}
  263|       |
  264|     86|		return nr;
  265|     86|	}
  266|     86|}
write_in_full:
  306|     86|{
  307|     86|	const char *p = buf;
  308|     86|	ssize_t total = 0;
  309|       |
  310|    172|	while (count > 0) {
  ------------------
  |  Branch (310:9): [True: 86, False: 86]
  ------------------
  311|     86|		ssize_t written = xwrite(fd, p, count);
  312|     86|		if (written < 0)
  ------------------
  |  Branch (312:7): [True: 0, False: 86]
  ------------------
  313|      0|			return -1;
  314|     86|		if (!written) {
  ------------------
  |  Branch (314:7): [True: 0, False: 86]
  ------------------
  315|      0|			errno = ENOSPC;
  316|      0|			return -1;
  317|      0|		}
  318|     86|		count -= written;
  319|     86|		p += written;
  320|     86|		total += written;
  321|     86|	}
  322|       |
  323|     86|	return total;
  324|     86|}
wrapper.c:do_xmalloc:
   50|    180|{
   51|    180|	void *ret;
   52|       |
   53|    180|	if (memory_limit_check(size, gentle))
  ------------------
  |  Branch (53:6): [True: 0, False: 180]
  ------------------
   54|      0|		return NULL;
   55|    180|	ret = malloc(size);
   56|    180|	if (!ret && !size)
  ------------------
  |  Branch (56:6): [True: 0, False: 180]
  |  Branch (56:14): [True: 0, False: 0]
  ------------------
   57|      0|		ret = malloc(1);
   58|    180|	if (!ret) {
  ------------------
  |  Branch (58:6): [True: 0, False: 180]
  ------------------
   59|      0|		if (!gentle)
  ------------------
  |  Branch (59:7): [True: 0, False: 0]
  ------------------
   60|      0|			die("Out of memory, malloc failed (tried to allocate %lu bytes)",
   61|      0|			    (unsigned long)size);
   62|      0|		else {
   63|      0|			error("Out of memory, malloc failed (tried to allocate %lu bytes)",
  ------------------
  |  |  456|      0|#define error(...) (error(__VA_ARGS__), const_error())
  ------------------
   64|      0|			      (unsigned long)size);
   65|      0|			return NULL;
   66|      0|		}
   67|      0|	}
   68|       |#ifdef XMALLOC_POISON
   69|       |	memset(ret, 0xA5, size);
   70|       |#endif
   71|    180|	return ret;
   72|    180|}
wrapper.c:memory_limit_check:
   22|    877|{
   23|    877|	static size_t limit = 0;
   24|    877|	if (!limit) {
  ------------------
  |  Branch (24:6): [True: 1, False: 876]
  ------------------
   25|      1|		limit = git_env_ulong("GIT_ALLOC_LIMIT", 0);
   26|      1|		if (!limit)
  ------------------
  |  Branch (26:7): [True: 1, False: 0]
  ------------------
   27|      1|			limit = SIZE_MAX;
   28|      1|	}
   29|    877|	if (size > limit) {
  ------------------
  |  Branch (29:6): [True: 0, False: 877]
  ------------------
   30|      0|		if (gentle) {
  ------------------
  |  Branch (30:7): [True: 0, False: 0]
  ------------------
   31|      0|			error("attempting to allocate %"PRIuMAX" over limit %"PRIuMAX,
  ------------------
  |  |  456|      0|#define error(...) (error(__VA_ARGS__), const_error())
  ------------------
   32|      0|			      (uintmax_t)size, (uintmax_t)limit);
   33|      0|			return -1;
   34|      0|		} else
   35|      0|			die("attempting to allocate %"PRIuMAX" over limit %"PRIuMAX,
   36|      0|			    (uintmax_t)size, (uintmax_t)limit);
   37|      0|	}
   38|    877|	return 0;
   39|    877|}

