a759bfa9ee
These tests exercises writing commit graph with Bloom filters and exercises 'git log -- path' with all the applicable options. They check that the output is the same with and without Bloom filters, confirm Bloom filters were used by checking if trace2 statistics were logged correctly. Also confirms cases where Bloom filters are not used: 1. Multiple path specs, 2. --walk-reflogs (see patch titled 'revision.c: use Bloom filters...' for details, 3. If the latest commit graph does not have Bloom filters Signed-off-by: Garima Singh <garima.singh@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
58 lines
1.3 KiB
C
58 lines
1.3 KiB
C
#include "test-tool.h"
|
|
#include "cache.h"
|
|
#include "commit-graph.h"
|
|
#include "repository.h"
|
|
#include "object-store.h"
|
|
|
|
int cmd__read_graph(int argc, const char **argv)
|
|
{
|
|
struct commit_graph *graph = NULL;
|
|
char *graph_name;
|
|
int open_ok;
|
|
int fd;
|
|
struct stat st;
|
|
struct object_directory *odb;
|
|
|
|
setup_git_directory();
|
|
odb = the_repository->objects->odb;
|
|
|
|
graph_name = get_commit_graph_filename(odb);
|
|
|
|
open_ok = open_commit_graph(graph_name, &fd, &st);
|
|
if (!open_ok)
|
|
die_errno(_("Could not open commit-graph '%s'"), graph_name);
|
|
|
|
graph = load_commit_graph_one_fd_st(fd, &st, odb);
|
|
if (!graph)
|
|
return 1;
|
|
|
|
FREE_AND_NULL(graph_name);
|
|
|
|
printf("header: %08x %d %d %d %d\n",
|
|
ntohl(*(uint32_t*)graph->data),
|
|
*(unsigned char*)(graph->data + 4),
|
|
*(unsigned char*)(graph->data + 5),
|
|
*(unsigned char*)(graph->data + 6),
|
|
*(unsigned char*)(graph->data + 7));
|
|
printf("num_commits: %u\n", graph->num_commits);
|
|
printf("chunks:");
|
|
|
|
if (graph->chunk_oid_fanout)
|
|
printf(" oid_fanout");
|
|
if (graph->chunk_oid_lookup)
|
|
printf(" oid_lookup");
|
|
if (graph->chunk_commit_data)
|
|
printf(" commit_metadata");
|
|
if (graph->chunk_extra_edges)
|
|
printf(" extra_edges");
|
|
if (graph->chunk_bloom_indexes)
|
|
printf(" bloom_indexes");
|
|
if (graph->chunk_bloom_data)
|
|
printf(" bloom_data");
|
|
printf("\n");
|
|
|
|
UNLEAK(graph);
|
|
|
|
return 0;
|
|
}
|