Skip to content

Commit 8771214

Browse files
John Caigitster
authored andcommitted
repository: BUG when is_bare_cfg is not initialized
The is_bare_cfg member of the repository struct should be properly initiated when setting up a repository. BUG when repo_is_bare() sees that the flag has not been set. Signed-off-by: John Cai <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1c2d052 commit 8771214

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

repository.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,5 +464,7 @@ int repo_hold_locked_index(struct repository *repo,
464464
int repo_is_bare(struct repository *repo)
465465
{
466466
/* if core.bare is not 'false', let's see if there is a work tree */
467+
if (repo->is_bare_cfg < 0 )
468+
BUG("is_bare_cfg unspecified");
467469
return repo->is_bare_cfg && !repo_get_work_tree(repo);
468470
}

0 commit comments

Comments
 (0)