diff options
author | Glen Choo <chooglen@google.com> | 2023-06-28 22:26:23 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-06-29 00:06:39 +0300 |
commit | 6021e1d1580169532512772afbb86996f717f4ae (patch) | |
tree | a1719587ba91dbeb5f8535bf6c7e121c36d587a2 /builtin/remote.c | |
parent | a4e7e317f8f27f861321e6eb08b9c8c0f3ab570c (diff) |
config.c: pass ctx in configsets
Pass config_context to config callbacks in configset_iter(), trivially
setting the .kvi member to the cached key_value_info. Then, in config
callbacks that are only used with configsets, use the .kvi member to
replace calls to current_config_*(), and delete current_config_line()
because it has no remaining callers.
This leaves builtin/config.c and config.c as the only remaining users of
current_config_*().
Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/remote.c')
-rw-r--r-- | builtin/remote.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/builtin/remote.c b/builtin/remote.c index 87de81105e..d47f9ee21c 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -646,17 +646,19 @@ struct push_default_info }; static int config_read_push_default(const char *key, const char *value, - const struct config_context *ctx UNUSED, void *cb) + const struct config_context *ctx, void *cb) { + const struct key_value_info *kvi = ctx->kvi; + struct push_default_info* info = cb; if (strcmp(key, "remote.pushdefault") || !value || strcmp(value, info->old_name)) return 0; - info->scope = current_config_scope(); + info->scope = kvi->scope; strbuf_reset(&info->origin); - strbuf_addstr(&info->origin, current_config_name()); - info->linenr = current_config_line(); + strbuf_addstr(&info->origin, config_origin_type_name(kvi->origin_type)); + info->linenr = kvi->linenr; return 0; } |