Commit 796fa0dd by Edward Thomson

sysdir: allow resetting cached system dirs

parent 7fd5dfa0
......@@ -189,9 +189,25 @@ int git_sysdir_global_init(void)
for (i = 0; !error && i < ARRAY_SIZE(git_sysdir__dirs); i++)
error = git_sysdir__dirs[i].guess(&git_sysdir__dirs[i].buf);
if (error)
return error;
return git_runtime_shutdown_register(git_sysdir_global_shutdown);
}
int git_sysdir_reset(void)
{
size_t i;
int error = 0;
for (i = 0; !error && i < ARRAY_SIZE(git_sysdir__dirs); ++i) {
git_str_dispose(&git_sysdir__dirs[i].buf);
error = git_sysdir__dirs[i].guess(&git_sysdir__dirs[i].buf);
}
return error;
}
static int git_sysdir_check_selector(git_sysdir_t which)
{
if (which < ARRAY_SIZE(git_sysdir__dirs))
......
......@@ -105,4 +105,9 @@ extern int git_sysdir_get(const git_str **out, git_sysdir_t which);
*/
extern int git_sysdir_set(git_sysdir_t which, const char *paths);
/**
* Reset search paths for global/system/xdg files.
*/
extern int git_sysdir_reset(void);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment