Commit a7fbb051 by Etienne Samson Committed by Patrick Steinhardt

repository: being a worktree means we're not really bare

We were previously conflating any error into GIT_ENOTFOUND, which might
or might not be correct. This fixes the code so a config error is
bubbled up, as well as preserving the semantics in the face of
worktree-repositories
parent 68e55c3a
...@@ -268,11 +268,15 @@ static int load_config_data(git_repository *repo, const git_config *config) ...@@ -268,11 +268,15 @@ static int load_config_data(git_repository *repo, const git_config *config)
{ {
int is_bare; int is_bare;
int err = git_config_get_bool(&is_bare, config, "core.bare");
if (err < 0 && err != GIT_ENOTFOUND)
return err;
/* Try to figure out if it's bare, default to non-bare if it's not set */ /* Try to figure out if it's bare, default to non-bare if it's not set */
if (git_config_get_bool(&is_bare, config, "core.bare") < 0) if (err != GIT_ENOTFOUND)
repo->is_bare = 0; repo->is_bare = is_bare && !repo->is_worktree;
else else
repo->is_bare = is_bare; repo->is_bare = 0;
return 0; return 0;
} }
......
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