Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2019-06-18 21:14:32 +0300
committerJunio C Hamano <gitster@pobox.com>2019-06-20 06:46:26 +0300
commitc2bc6e6ab0ade70c475a73d06326e677e70840d2 (patch)
tree20d1dd905115b734e05c4db5711bb8ac05693c66 /builtin/commit-graph.c
parent8d84097f9655a954ea7e94ba08d93e5940ccb2ae (diff)
commit-graph: create options for split files
The split commit-graph feature is now fully implemented, but needs some more run-time configurability. Allow direct callers to 'git commit-graph write --split' to specify the values used in the merge strategy and the expire time. Update the documentation to specify these values. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit-graph.c')
-rw-r--r--builtin/commit-graph.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c
index ff8bc3c8b9e..6c0b5b17e00 100644
--- a/builtin/commit-graph.c
+++ b/builtin/commit-graph.c
@@ -10,7 +10,7 @@ static char const * const builtin_commit_graph_usage[] = {
N_("git commit-graph [--object-dir <objdir>]"),
N_("git commit-graph read [--object-dir <objdir>]"),
N_("git commit-graph verify [--object-dir <objdir>]"),
- N_("git commit-graph write [--object-dir <objdir>] [--append|--split] [--reachable|--stdin-packs|--stdin-commits]"),
+ N_("git commit-graph write [--object-dir <objdir>] [--append|--split] [--reachable|--stdin-packs|--stdin-commits] <split options>"),
NULL
};
@@ -25,7 +25,7 @@ static const char * const builtin_commit_graph_read_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]"),
+ N_("git commit-graph write [--object-dir <objdir>] [--append|--split] [--reachable|--stdin-packs|--stdin-commits] <split options>"),
NULL
};
@@ -135,6 +135,7 @@ static int graph_read(int argc, const char **argv)
}
extern int read_replace_refs;
+static struct split_commit_graph_opts split_opts;
static int graph_write(int argc, const char **argv)
{
@@ -158,9 +159,19 @@ static int graph_write(int argc, const char **argv)
N_("include all commits already in the commit-graph file")),
OPT_BOOL(0, "split", &opts.split,
N_("allow writing an incremental commit-graph file")),
+ OPT_INTEGER(0, "max-commits", &split_opts.max_commits,
+ N_("maximum number of commits in a non-base split commit-graph")),
+ OPT_INTEGER(0, "size-multiple", &split_opts.size_multiple,
+ N_("maximum ratio between two levels of a split commit-graph")),
+ OPT_EXPIRY_DATE(0, "expire-time", &split_opts.expire_time,
+ N_("maximum number of commits in a non-base split commit-graph")),
OPT_END(),
};
+ split_opts.size_multiple = 2;
+ split_opts.max_commits = 0;
+ split_opts.expire_time = 0;
+
argc = parse_options(argc, argv, NULL,
builtin_commit_graph_write_options,
builtin_commit_graph_write_usage, 0);
@@ -176,8 +187,11 @@ static int graph_write(int argc, const char **argv)
read_replace_refs = 0;
- if (opts.reachable)
- return write_commit_graph_reachable(opts.obj_dir, flags);
+ if (opts.reachable) {
+ if (write_commit_graph_reachable(opts.obj_dir, flags, &split_opts))
+ return 1;
+ return 0;
+ }
string_list_init(&lines, 0);
if (opts.stdin_packs || opts.stdin_commits) {
@@ -197,7 +211,8 @@ static int graph_write(int argc, const char **argv)
if (write_commit_graph(opts.obj_dir,
pack_indexes,
commit_hex,
- flags))
+ flags,
+ &split_opts))
result = 1;
UNLEAK(lines);