| 220 | } |
| 221 | |
| 222 | static int graph_write(int argc, const char **argv, const char *prefix, |
| 223 | struct repository *repo UNUSED) |
| 224 | { |
| 225 | struct string_list pack_indexes = STRING_LIST_INIT_DUP; |
| 226 | struct strbuf buf = STRBUF_INIT; |
| 227 | struct oidset commits = OIDSET_INIT; |
| 228 | struct odb_source *source = NULL; |
| 229 | int result = 0; |
| 230 | enum commit_graph_write_flags flags = 0; |
| 231 | struct progress *progress = NULL; |
| 232 | |
| 233 | static struct option builtin_commit_graph_write_options[] = { |
| 234 | OPT_BOOL(0, "reachable", &opts.reachable, |
| 235 | N_("start walk at all refs")), |
| 236 | OPT_BOOL(0, "stdin-packs", &opts.stdin_packs, |
| 237 | N_("scan pack-indexes listed by stdin for commits")), |
| 238 | OPT_BOOL(0, "stdin-commits", &opts.stdin_commits, |
| 239 | N_("start walk at commits listed by stdin")), |
| 240 | OPT_BOOL(0, "append", &opts.append, |
| 241 | N_("include all commits already in the commit-graph file")), |
| 242 | OPT_BOOL(0, "changed-paths", &opts.enable_changed_paths, |
| 243 | N_("enable computation for changed paths")), |
| 244 | OPT_CALLBACK_F(0, "split", &write_opts.split_flags, NULL, |
| 245 | N_("allow writing an incremental commit-graph file"), |
| 246 | PARSE_OPT_OPTARG | PARSE_OPT_NONEG, |
| 247 | write_option_parse_split), |
| 248 | OPT_INTEGER(0, "max-commits", &write_opts.max_commits, |
| 249 | N_("maximum number of commits in a non-base split commit-graph")), |
| 250 | OPT_INTEGER(0, "size-multiple", &write_opts.size_multiple, |
| 251 | N_("maximum ratio between two levels of a split commit-graph")), |
| 252 | OPT_EXPIRY_DATE(0, "expire-time", &write_opts.expire_time, |
| 253 | N_("only expire files older than a given date-time")), |
| 254 | OPT_CALLBACK_F(0, "max-new-filters", &write_opts.max_new_filters, |
| 255 | NULL, N_("maximum number of changed-path Bloom filters to compute"), |
| 256 | 0, write_option_max_new_filters), |
| 257 | OPT_BOOL(0, "progress", &opts.progress, |
| 258 | N_("force progress reporting")), |
| 259 | OPT_END(), |
| 260 | }; |
| 261 | struct option *options = add_common_options(builtin_commit_graph_write_options); |
| 262 | |
| 263 | opts.progress = isatty(2); |
| 264 | opts.enable_changed_paths = -1; |
| 265 | write_opts.size_multiple = 2; |
| 266 | write_opts.max_commits = 0; |
| 267 | write_opts.expire_time = 0; |
| 268 | write_opts.max_new_filters = -1; |
| 269 | |
| 270 | trace2_cmd_mode("write"); |
| 271 | |
| 272 | repo_config(the_repository, git_commit_graph_write_config, &opts); |
| 273 | |
| 274 | argc = parse_options(argc, argv, prefix, |
| 275 | options, |
| 276 | builtin_commit_graph_write_usage, 0); |
| 277 | if (argc) |
| 278 | usage_with_options(builtin_commit_graph_write_usage, options); |
| 279 |
nothing calls this directly
no test coverage detected