1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#include "builtin.h"
#include "config.h"
#include "diff-hunks.h"
#include "gettext.h"
#include "parse-options.h"
#include "repository.h"
static const char * const diff_hunks_usage[] = {
N_("git diff-hunks verify"),
N_("git diff-hunks clear"),
NULL
};
static int cmd_diff_hunks_verify(int argc, const char **argv,
const char *prefix UNUSED,
struct repository *r)
{
struct option options[] = { OPT_END() };
argc = parse_options(argc, argv, NULL, options, diff_hunks_usage, 0);
if (argc)
usage_with_options(diff_hunks_usage, options);
return diff_hunks_verify(r) ? 1 : 0;
}
static int cmd_diff_hunks_clear(int argc, const char **argv,
const char *prefix UNUSED,
struct repository *r)
{
struct option options[] = { OPT_END() };
argc = parse_options(argc, argv, NULL, options, diff_hunks_usage, 0);
if (argc)
usage_with_options(diff_hunks_usage, options);
return diff_hunks_clear(r) ? 1 : 0;
}
int cmd_diff_hunks(int argc, const char **argv, const char *prefix,
struct repository *repo)
{
parse_opt_subcommand_fn *fn = NULL;
struct option options[] = {
OPT_SUBCOMMAND("verify", &fn, cmd_diff_hunks_verify),
OPT_SUBCOMMAND("clear", &fn, cmd_diff_hunks_clear),
OPT_END()
};
repo_config(repo, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options, diff_hunks_usage, 0);
return fn(argc, argv, prefix, repo);
}
|