Skip to content

Commit 44c7e62

Browse files
ldenningtongitster
authored andcommitted
repo-settings: prepare_repo_settings only in git repos
Check whether git directory exists before adding any repo settings. If it does not exist, BUG with the message that one cannot add settings for an uninitialized repository. If it does exist, proceed with adding repo settings. Signed-off-by: Lessley Dennington <[email protected]> Reviewed-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 27a443b commit 44c7e62

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

repo-settings.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ void prepare_repo_settings(struct repository *r)
1717
char *strval;
1818
int manyfiles;
1919

20+
if (!r->gitdir)
21+
BUG("Cannot add settings for uninitialized repository");
22+
2023
if (r->settings.initialized++)
2124
return;
2225

0 commit comments

Comments
 (0)