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 <lessleydennington@gmail.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Lessley Dennington authored and Junio C Hamano committed 2021-12-06 09:55:06 -08:00
1 parent 27a443b820
commit 44c7e62e51
1 file changed
+3
+3
View File
@@ -17,6 +17,9 @@ void prepare_repo_settings(struct repository *r)
char *strval;
int manyfiles;
if (!r->gitdir)
BUG("Cannot add settings for uninitialized repository");
if (r->settings.initialized++)
return;