mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-11 16:34:33 +00:00
repository: Do not double-free config
This commit is contained in:
parent
4e96411748
commit
74240afb9c
@ -1691,20 +1691,20 @@ int git_repository_set_bare(git_repository *repo)
|
|||||||
if (repo->is_bare)
|
if (repo->is_bare)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((error = git_repository_config__weakptr(&config, repo)) < 0 ||
|
if ((error = git_repository_config__weakptr(&config, repo)) < 0)
|
||||||
(error = git_config_set_bool(config, "core.bare", false)) < 0)
|
return error;
|
||||||
goto done;
|
|
||||||
|
|
||||||
error = git_config__update_entry(config, "core.worktree", NULL, true, true);
|
if ((error = git_config_set_bool(config, "core.bare", false)) < 0)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
if ((error = git_config__update_entry(config, "core.worktree", NULL, true, true)) < 0)
|
||||||
|
return error;
|
||||||
|
|
||||||
git__free(repo->workdir);
|
git__free(repo->workdir);
|
||||||
repo->workdir = NULL;
|
repo->workdir = NULL;
|
||||||
|
|
||||||
repo->is_bare = 1;
|
repo->is_bare = 1;
|
||||||
|
|
||||||
done:
|
return 0;
|
||||||
git_config_free(config);
|
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int git_repository_head_tree(git_tree **tree, git_repository *repo)
|
int git_repository_head_tree(git_tree **tree, git_repository *repo)
|
||||||
|
Loading…
Reference in New Issue
Block a user