]> git.ipfire.org Git - thirdparty/git.git/commitdiff
drop pure pass-through config callbacks
authorJeff King <peff@peff.net>
Sun, 26 Feb 2023 22:40:46 +0000 (17:40 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Feb 2023 16:00:39 +0000 (08:00 -0800)
Commit fd2d4c135e (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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/am.c
builtin/commit-tree.c
builtin/verify-commit.c
builtin/verify-tag.c

index 40126b59c541710435e6c56179e5168d7576f88b..fccf40f8ee754cb172280167a43ad6a864e09326 100644 (file)
@@ -2312,11 +2312,6 @@ static int parse_opt_show_current_patch(const struct option *opt, const char *ar
        return 0;
 }
 
-static int git_am_config(const char *k, const char *v, void *cb UNUSED)
-{
-       return git_default_config(k, v, NULL);
-}
-
 int cmd_am(int argc, const char **argv, const char *prefix)
 {
        struct am_state state;
@@ -2440,7 +2435,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
        if (argc == 2 && !strcmp(argv[1], "-h"))
                usage_with_options(usage, options);
 
-       git_config(git_am_config, NULL);
+       git_config(git_default_config, NULL);
 
        am_state_init(&state);
 
index f6a099d601c4a0c4984757129081c551d1a01f4c..c0bbe9373d07a098591725108d384cbced5f1e41 100644 (file)
@@ -37,11 +37,6 @@ static void new_parent(struct commit *parent, struct commit_list **parents_p)
        commit_list_insert(parent, parents_p);
 }
 
-static int commit_tree_config(const char *var, const char *value, void *cb)
-{
-       return git_default_config(var, value, cb);
-}
-
 static int parse_parent_arg_callback(const struct option *opt,
                const char *arg, int unset)
 {
@@ -118,7 +113,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
                OPT_END()
        };
 
-       git_config(commit_tree_config, NULL);
+       git_config(git_default_config, NULL);
 
        if (argc < 2 || !strcmp(argv[1], "-h"))
                usage_with_options(commit_tree_usage, options);
index 3c5d0b024c9a58a27ef317e767c43177dc980f69..7aedf10e856952f035d506dd678b8dfb8b410ebc 100644 (file)
@@ -52,11 +52,6 @@ static int verify_commit(const char *name, unsigned flags)
        return run_gpg_verify((struct commit *)obj, flags);
 }
 
-static int git_verify_commit_config(const char *var, const char *value, void *cb)
-{
-       return git_default_config(var, value, cb);
-}
-
 int cmd_verify_commit(int argc, const char **argv, const char *prefix)
 {
        int i = 1, verbose = 0, had_error = 0;
@@ -67,7 +62,7 @@ int cmd_verify_commit(int argc, const char **argv, const char *prefix)
                OPT_END()
        };
 
-       git_config(git_verify_commit_config, NULL);
+       git_config(git_default_config, NULL);
 
        argc = parse_options(argc, argv, prefix, verify_commit_options,
                             verify_commit_usage, PARSE_OPT_KEEP_ARGV0);
index ecffb069bf15f75e49d3f3d205f6fc18d0b42346..5c00b0b0f77d4e16301b5726dde640426604434e 100644 (file)
@@ -19,11 +19,6 @@ static const char * const verify_tag_usage[] = {
                NULL
 };
 
-static int git_verify_tag_config(const char *var, const char *value, void *cb)
-{
-       return git_default_config(var, value, cb);
-}
-
 int cmd_verify_tag(int argc, const char **argv, const char *prefix)
 {
        int i = 1, verbose = 0, had_error = 0;
@@ -36,7 +31,7 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)
                OPT_END()
        };
 
-       git_config(git_verify_tag_config, NULL);
+       git_config(git_default_config, NULL);
 
        argc = parse_options(argc, argv, prefix, verify_tag_options,
                             verify_tag_usage, PARSE_OPT_KEEP_ARGV0);