diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-03-18 00:03:10 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-03-18 00:03:10 +0300 |
commit | af5388d2ddb0bc7c22fbe698078f4ca07879d954 (patch) | |
tree | 6829523f0d96f2014ea373a7aa5b35cdc3c45420 /builtin | |
parent | d0732a8120d9cc62d8b6efa4ec48966f890f84b7 (diff) | |
parent | cc5d1d32fd489f7eb98f762de303b499f2117638 (diff) |
Merge branch 'jc/gpg-lazy-init'
Instead of forcing each command to choose to honor GPG related
configuration variables, make the subsystem lazily initialize
itself.
* jc/gpg-lazy-init:
drop pure pass-through config callbacks
gpg-interface: lazily initialize and read the configuration
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/am.c | 13 | ||||
-rw-r--r-- | builtin/commit-tree.c | 10 | ||||
-rw-r--r-- | builtin/commit.c | 4 | ||||
-rw-r--r-- | builtin/log.c | 2 | ||||
-rw-r--r-- | builtin/merge.c | 3 | ||||
-rw-r--r-- | builtin/pull.c | 6 | ||||
-rw-r--r-- | builtin/push.c | 5 | ||||
-rw-r--r-- | builtin/receive-pack.c | 4 | ||||
-rw-r--r-- | builtin/send-pack.c | 2 | ||||
-rw-r--r-- | builtin/tag.c | 5 | ||||
-rw-r--r-- | builtin/verify-commit.c | 10 | ||||
-rw-r--r-- | builtin/verify-tag.c | 10 |
12 files changed, 4 insertions, 70 deletions
diff --git a/builtin/am.c b/builtin/am.c index 3b5ea50cc5..5e6b237c42 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -2301,17 +2301,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) -{ - int status; - - status = git_gpg_config(k, v, NULL); - if (status) - return status; - - return git_default_config(k, v, NULL); -} - int cmd_am(int argc, const char **argv, const char *prefix) { struct am_state state; @@ -2435,7 +2424,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); diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c index fefeed5d4b..e805da5bb1 100644 --- a/builtin/commit-tree.c +++ b/builtin/commit-tree.c @@ -38,14 +38,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) -{ - int status = git_gpg_config(var, value, NULL); - if (status) - return status; - return git_default_config(var, value, cb); -} - static int parse_parent_arg_callback(const struct option *opt, const char *arg, int unset) { @@ -122,7 +114,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); diff --git a/builtin/commit.c b/builtin/commit.c index 985a0445b7..f71ed41bf5 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1600,7 +1600,6 @@ int cmd_status(int argc, const char **argv, const char *prefix) static int git_commit_config(const char *k, const char *v, void *cb) { struct wt_status *s = cb; - int status; if (!strcmp(k, "commit.template")) return git_config_pathname(&template_file, k, v); @@ -1620,9 +1619,6 @@ static int git_commit_config(const char *k, const char *v, void *cb) return 0; } - status = git_gpg_config(k, v, NULL); - if (status) - return status; return git_status_config(k, v, s); } diff --git a/builtin/log.c b/builtin/log.c index 0368e08926..b62e629ba8 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -603,8 +603,6 @@ static int git_log_config(const char *var, const char *value, void *cb) return 0; } - if (git_gpg_config(var, value, cb) < 0) - return -1; return git_diff_ui_config(var, value, cb); } diff --git a/builtin/merge.c b/builtin/merge.c index 7347b738e5..19c31d4ff4 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -663,9 +663,6 @@ static int git_merge_config(const char *k, const char *v, void *cb) status = fmt_merge_msg_config(k, v, cb); if (status) return status; - status = git_gpg_config(k, v, NULL); - if (status) - return status; return git_diff_ui_config(k, v, cb); } diff --git a/builtin/pull.c b/builtin/pull.c index 963a47f0b8..56f679d94a 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -360,8 +360,6 @@ static enum rebase_type config_get_rebase(int *rebase_unspecified) */ static int git_pull_config(const char *var, const char *value, void *cb) { - int status; - if (!strcmp(var, "rebase.autostash")) { config_autostash = git_config_bool(var, value); return 0; @@ -373,10 +371,6 @@ static int git_pull_config(const char *var, const char *value, void *cb) check_trust_level = 0; } - status = git_gpg_config(var, value, cb); - if (status) - return status; - return git_default_config(var, value, cb); } diff --git a/builtin/push.c b/builtin/push.c index 8f7d326ab3..12a402aea3 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -508,11 +508,6 @@ static int git_push_config(const char *k, const char *v, void *cb) { const char *slot_name; int *flags = cb; - int status; - - status = git_gpg_config(k, v, NULL); - if (status) - return status; if (!strcmp(k, "push.followtags")) { if (git_config_bool(k, v)) diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 3d2b4c8b4f..fe68c79ee3 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -137,10 +137,6 @@ static int receive_pack_config(const char *var, const char *value, void *cb) if (status) return status; - status = git_gpg_config(var, value, NULL); - if (status) - return status; - if (strcmp(var, "receive.denydeletes") == 0) { deny_deletes = git_config_bool(var, value); return 0; diff --git a/builtin/send-pack.c b/builtin/send-pack.c index 127ced435d..fb5b2bad2c 100644 --- a/builtin/send-pack.c +++ b/builtin/send-pack.c @@ -131,8 +131,6 @@ static void print_helper_status(struct ref *ref) static int send_pack_config(const char *k, const char *v, void *cb) { - git_gpg_config(k, v, NULL); - if (!strcmp(k, "push.gpgsign")) { const char *value; if (!git_config_get_value("push.gpgsign", &value)) { diff --git a/builtin/tag.c b/builtin/tag.c index be094882d0..7cdcd4293d 100644 --- a/builtin/tag.c +++ b/builtin/tag.c @@ -181,8 +181,6 @@ static const char tag_template_nocleanup[] = static int git_tag_config(const char *var, const char *value, void *cb) { - int status; - if (!strcmp(var, "tag.gpgsign")) { config_sign_tag = git_config_bool(var, value); return 0; @@ -195,9 +193,6 @@ static int git_tag_config(const char *var, const char *value, void *cb) return 0; } - status = git_gpg_config(var, value, cb); - if (status) - return status; if (!strcmp(var, "tag.forcesignannotated")) { force_sign_annotate = git_config_bool(var, value); return 0; diff --git a/builtin/verify-commit.c b/builtin/verify-commit.c index 3ebad32b0f..7aedf10e85 100644 --- a/builtin/verify-commit.c +++ b/builtin/verify-commit.c @@ -52,14 +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) -{ - int status = git_gpg_config(var, value, cb); - if (status) - return status; - 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; @@ -70,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); diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c index 217566952d..5c00b0b0f7 100644 --- a/builtin/verify-tag.c +++ b/builtin/verify-tag.c @@ -19,14 +19,6 @@ static const char * const verify_tag_usage[] = { NULL }; -static int git_verify_tag_config(const char *var, const char *value, void *cb) -{ - int status = git_gpg_config(var, value, cb); - if (status) - return status; - 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; @@ -39,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); |