Skip to content

Commit cc5d1d3

Browse files
peffgitster
authored andcommitted
drop pure pass-through config callbacks
Commit fd2d4c1 (gpg-interface: lazily initialize and read the configuration, 2023-02-09) shrunk a few custom config callbacks so that they are just one-liners of: return git_default_config(...); We can drop them entirely and replace them direct calls of git_default_config() intead. This makes the code a little shorter and easier to understand (with the downside being that if they do grow custom options again later, we'll have to recreate the functions). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fd2d4c1 commit cc5d1d3

File tree

4 files changed

+4
-24
lines changed

4 files changed

+4
-24
lines changed

builtin/am.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2312,11 +2312,6 @@ static int parse_opt_show_current_patch(const struct option *opt, const char *ar
23122312
return 0;
23132313
}
23142314

2315-
static int git_am_config(const char *k, const char *v, void *cb UNUSED)
2316-
{
2317-
return git_default_config(k, v, NULL);
2318-
}
2319-
23202315
int cmd_am(int argc, const char **argv, const char *prefix)
23212316
{
23222317
struct am_state state;
@@ -2440,7 +2435,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
24402435
if (argc == 2 && !strcmp(argv[1], "-h"))
24412436
usage_with_options(usage, options);
24422437

2443-
git_config(git_am_config, NULL);
2438+
git_config(git_default_config, NULL);
24442439

24452440
am_state_init(&state);
24462441

builtin/commit-tree.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ static void new_parent(struct commit *parent, struct commit_list **parents_p)
3737
commit_list_insert(parent, parents_p);
3838
}
3939

40-
static int commit_tree_config(const char *var, const char *value, void *cb)
41-
{
42-
return git_default_config(var, value, cb);
43-
}
44-
4540
static int parse_parent_arg_callback(const struct option *opt,
4641
const char *arg, int unset)
4742
{
@@ -118,7 +113,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
118113
OPT_END()
119114
};
120115

121-
git_config(commit_tree_config, NULL);
116+
git_config(git_default_config, NULL);
122117

123118
if (argc < 2 || !strcmp(argv[1], "-h"))
124119
usage_with_options(commit_tree_usage, options);

builtin/verify-commit.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ static int verify_commit(const char *name, unsigned flags)
5252
return run_gpg_verify((struct commit *)obj, flags);
5353
}
5454

55-
static int git_verify_commit_config(const char *var, const char *value, void *cb)
56-
{
57-
return git_default_config(var, value, cb);
58-
}
59-
6055
int cmd_verify_commit(int argc, const char **argv, const char *prefix)
6156
{
6257
int i = 1, verbose = 0, had_error = 0;
@@ -67,7 +62,7 @@ int cmd_verify_commit(int argc, const char **argv, const char *prefix)
6762
OPT_END()
6863
};
6964

70-
git_config(git_verify_commit_config, NULL);
65+
git_config(git_default_config, NULL);
7166

7267
argc = parse_options(argc, argv, prefix, verify_commit_options,
7368
verify_commit_usage, PARSE_OPT_KEEP_ARGV0);

builtin/verify-tag.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ static const char * const verify_tag_usage[] = {
1919
NULL
2020
};
2121

22-
static int git_verify_tag_config(const char *var, const char *value, void *cb)
23-
{
24-
return git_default_config(var, value, cb);
25-
}
26-
2722
int cmd_verify_tag(int argc, const char **argv, const char *prefix)
2823
{
2924
int i = 1, verbose = 0, had_error = 0;
@@ -36,7 +31,7 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)
3631
OPT_END()
3732
};
3833

39-
git_config(git_verify_tag_config, NULL);
34+
git_config(git_default_config, NULL);
4035

4136
argc = parse_options(argc, argv, prefix, verify_tag_options,
4237
verify_tag_usage, PARSE_OPT_KEEP_ARGV0);

0 commit comments

Comments
 (0)