builtin / commit-graph.con commit commit-graph: create git-commit-graph builtin (4ce58ee)
   1#include "builtin.h"
   2#include "config.h"
   3#include "parse-options.h"
   4
   5static char const * const builtin_commit_graph_usage[] = {
   6        N_("git commit-graph [--object-dir <objdir>]"),
   7        NULL
   8};
   9
  10static struct opts_commit_graph {
  11        const char *obj_dir;
  12} opts;
  13
  14
  15int cmd_commit_graph(int argc, const char **argv, const char *prefix)
  16{
  17        static struct option builtin_commit_graph_options[] = {
  18                OPT_STRING(0, "object-dir", &opts.obj_dir,
  19                        N_("dir"),
  20                        N_("The object directory to store the graph")),
  21                OPT_END(),
  22        };
  23
  24        if (argc == 2 && !strcmp(argv[1], "-h"))
  25                usage_with_options(builtin_commit_graph_usage,
  26                                   builtin_commit_graph_options);
  27
  28        git_config(git_default_config, NULL);
  29        argc = parse_options(argc, argv, prefix,
  30                             builtin_commit_graph_options,
  31                             builtin_commit_graph_usage,
  32                             PARSE_OPT_STOP_AT_NON_OPTION);
  33
  34        usage_with_options(builtin_commit_graph_usage,
  35                           builtin_commit_graph_options);
  36}