libgit2/libgit2 — pull request #1291 by sba1 (2013-01-29 12:22:33+00:00)
Title: Introduction of config opts and default config fix

In this change, some new configuration options are introduced to query and set default paths of the configuration layer system. This is useful for users that want to have more control about the location of default config files.

Also, as demonstrated, this is useful to ensure that all tests that directly or indirectly (by calling git_config_open_default()) make use of these configuration files, run isolated. A problem in the initialization of a repository with template, which, without the config path opts, would work if a config file on the users computer (e.g., ~/.gitconfig) can be found, but doesn't if it couldn't be found (due to assert()s in config queries implied by git_repository_init_ext()), is identified. The very problem is fixed in git_config_open_default() by returning a failure if no config file can be found. Thus, functions should no longer query the empty config.

Note that there are other possibilities to fix the assert()/empty config problem. For instance, one could allow config queries if the configuration isn't backed up by any config file. This would IMO make more sense, but it has more implications concerning the semantics of the config system, this could be by a later change (if at all).

I also recommend to set the config files to system-independent test files when running the test in a global manner. This is not done in this change.