test-config: setup git directory
authorJeff King <peff@peff.net>
Tue, 13 Sep 2016 03:24:10 +0000 (20:24 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Sep 2016 22:45:45 +0000 (15:45 -0700)
The t1308 test script uses our test-config helper to read
repository-level config, but never actually sets up the
repository. This works because git_config() blindly reads
".git/config" even if we have not configured a repository.

This means that test-config won't work from a subdirectory,
though since it's just a helper for the test scripts, that's
not a big deal.

More important is that the behavior of git_config() is going
to change, and we want to make sure that t1308 continues to
work. We can just use setup_git_directory(), and not the
gentle form; there's no point in being flexible, as it's
just a helper for the tests.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
test-config.c
index 6a775522105d9bfc5c1c60f36944bc43e64badef..7ee3210da35d1acf5da88321dc465e2cd85b325f 100644 (file)
@@ -39,6 +39,9 @@ int main(int argc, char **argv)
        const char *v;
        const struct string_list *strptr;
        struct config_set cs;
+
+       setup_git_directory();
+
        git_configset_init(&cs);
 
        if (argc < 2) {