commit-graph: add --changed-paths option to write subcommand
Add --changed-paths option to git commit-graph write. This option will allow users to compute information about the paths that have changed between a commit and its first parent, and write it into the commit graph file. If the option is passed to the write subcommand we set the COMMIT_GRAPH_WRITE_BLOOM_FILTERS flag and pass it down to the commit-graph logic. Helped-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Garima Singh <garima.singh@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
1217c03e7b
commit
d38e07b8c4
|
@ -57,6 +57,11 @@ or `--stdin-packs`.)
|
||||||
With the `--append` option, include all commits that are present in the
|
With the `--append` option, include all commits that are present in the
|
||||||
existing commit-graph file.
|
existing commit-graph file.
|
||||||
+
|
+
|
||||||
|
With the `--changed-paths` option, compute and write information about the
|
||||||
|
paths changed between a commit and it's first parent. This operation can
|
||||||
|
take a while on large repositories. It provides significant performance gains
|
||||||
|
for getting history of a directory or a file with `git log -- <path>`.
|
||||||
|
+
|
||||||
With the `--split` option, write the commit-graph as a chain of multiple
|
With the `--split` option, write the commit-graph as a chain of multiple
|
||||||
commit-graph files stored in `<dir>/info/commit-graphs`. The new commits
|
commit-graph files stored in `<dir>/info/commit-graphs`. The new commits
|
||||||
not already in the commit-graph are added in a new "tip" file. This file
|
not already in the commit-graph are added in a new "tip" file. This file
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
static char const * const builtin_commit_graph_usage[] = {
|
static char const * const builtin_commit_graph_usage[] = {
|
||||||
N_("git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]"),
|
N_("git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]"),
|
||||||
N_("git commit-graph write [--object-dir <objdir>] [--append|--split] [--reachable|--stdin-packs|--stdin-commits] [--[no-]progress] <split options>"),
|
N_("git commit-graph write [--object-dir <objdir>] [--append|--split] [--reachable|--stdin-packs|--stdin-commits] [--changed-paths] [--[no-]progress] <split options>"),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ static const char * const builtin_commit_graph_verify_usage[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char * const builtin_commit_graph_write_usage[] = {
|
static const char * const builtin_commit_graph_write_usage[] = {
|
||||||
N_("git commit-graph write [--object-dir <objdir>] [--append|--split] [--reachable|--stdin-packs|--stdin-commits] [--[no-]progress] <split options>"),
|
N_("git commit-graph write [--object-dir <objdir>] [--append|--split] [--reachable|--stdin-packs|--stdin-commits] [--changed-paths] [--[no-]progress] <split options>"),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ static struct opts_commit_graph {
|
||||||
int split;
|
int split;
|
||||||
int shallow;
|
int shallow;
|
||||||
int progress;
|
int progress;
|
||||||
|
int enable_changed_paths;
|
||||||
} opts;
|
} opts;
|
||||||
|
|
||||||
static struct object_directory *find_odb(struct repository *r,
|
static struct object_directory *find_odb(struct repository *r,
|
||||||
|
@ -135,6 +136,8 @@ static int graph_write(int argc, const char **argv)
|
||||||
N_("start walk at commits listed by stdin")),
|
N_("start walk at commits listed by stdin")),
|
||||||
OPT_BOOL(0, "append", &opts.append,
|
OPT_BOOL(0, "append", &opts.append,
|
||||||
N_("include all commits already in the commit-graph file")),
|
N_("include all commits already in the commit-graph file")),
|
||||||
|
OPT_BOOL(0, "changed-paths", &opts.enable_changed_paths,
|
||||||
|
N_("enable computation for changed paths")),
|
||||||
OPT_BOOL(0, "progress", &opts.progress, N_("force progress reporting")),
|
OPT_BOOL(0, "progress", &opts.progress, N_("force progress reporting")),
|
||||||
OPT_BOOL(0, "split", &opts.split,
|
OPT_BOOL(0, "split", &opts.split,
|
||||||
N_("allow writing an incremental commit-graph file")),
|
N_("allow writing an incremental commit-graph file")),
|
||||||
|
@ -168,6 +171,8 @@ static int graph_write(int argc, const char **argv)
|
||||||
flags |= COMMIT_GRAPH_WRITE_SPLIT;
|
flags |= COMMIT_GRAPH_WRITE_SPLIT;
|
||||||
if (opts.progress)
|
if (opts.progress)
|
||||||
flags |= COMMIT_GRAPH_WRITE_PROGRESS;
|
flags |= COMMIT_GRAPH_WRITE_PROGRESS;
|
||||||
|
if (opts.enable_changed_paths)
|
||||||
|
flags |= COMMIT_GRAPH_WRITE_BLOOM_FILTERS;
|
||||||
|
|
||||||
read_replace_refs = 0;
|
read_replace_refs = 0;
|
||||||
odb = find_odb(the_repository, opts.obj_dir);
|
odb = find_odb(the_repository, opts.obj_dir);
|
||||||
|
|
Loading…
Reference in New Issue