]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/helper/test-config.c
config: don't include config.h by default
[thirdparty/git.git] / t / helper / test-config.c
index 83a4f2ab86999876ecfb78c7e6dd108eb09b04ae..1a7b8bd3d650fe1111c77115d2c68644b6ac9edb 100644 (file)
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "config.h"
 #include "string-list.h"
 
 /*
@@ -66,6 +67,16 @@ static int iterate_cb(const char *var, const char *value, void *data)
        return 0;
 }
 
+static int early_config_cb(const char *var, const char *value, void *vdata)
+{
+       const char *key = vdata;
+
+       if (!strcmp(key, var))
+               printf("%s\n", value);
+
+       return 0;
+}
+
 int cmd_main(int argc, const char **argv)
 {
        int i, val;
@@ -73,6 +84,11 @@ int cmd_main(int argc, const char **argv)
        const struct string_list *strptr;
        struct config_set cs;
 
+       if (argc == 3 && !strcmp(argv[1], "read_early_config")) {
+               read_early_config(early_config_cb, (void *)argv[2]);
+               return 0;
+       }
+
        setup_git_directory();
 
        git_configset_init(&cs);