Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t/helper
diff options
context:
space:
mode:
authorGlen Choo <chooglen@google.com>2023-06-28 22:26:23 +0300
committerJunio C Hamano <gitster@pobox.com>2023-06-29 00:06:39 +0300
commit6021e1d1580169532512772afbb86996f717f4ae (patch)
treea1719587ba91dbeb5f8535bf6c7e121c36d587a2 /t/helper
parenta4e7e317f8f27f861321e6eb08b9c8c0f3ab570c (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 't/helper')
-rw-r--r--t/helper/test-config.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index 85ad815358..3f4c367831 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -43,9 +43,10 @@
*/
static int iterate_cb(const char *var, const char *value,
- const struct config_context *ctx UNUSED,
+ const struct config_context *ctx,
void *data UNUSED)
{
+ const struct key_value_info *kvi = ctx->kvi;
static int nr;
if (nr++)
@@ -53,10 +54,10 @@ static int iterate_cb(const char *var, const char *value,
printf("key=%s\n", var);
printf("value=%s\n", value ? value : "(null)");
- printf("origin=%s\n", current_config_origin_type());
- printf("name=%s\n", current_config_name());
- printf("lno=%d\n", current_config_line());
- printf("scope=%s\n", config_scope_name(current_config_scope()));
+ printf("origin=%s\n", config_origin_type_name(kvi->origin_type));
+ printf("name=%s\n", kvi->filename ? kvi->filename : "");
+ printf("lno=%d\n", kvi->linenr);
+ printf("scope=%s\n", config_scope_name(kvi->scope));
return 0;
}