init: expand comments explaining config trickery
git-init may copy "config" from the templates directory and then re-read it. There are some comments explaining what's going on here, but they are not grouped very well with the matching code. Let's rearrange and expand them. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Sep 12, 2016 at 20:24 UTC
7c0a842b46391230661d17ad758efa6b4eccdb93
1 file changed
+7
-4
builtin/init-db.c
+7
-4
@@ -191,16 +191,19 @@ static int create_default_files(const char *template_path)
191
/* Just look for `init.templatedir` */
192
git_config(git_init_db_config, NULL);
193
194
- /* First copy the templates -- we might have the default
194
+ /*
195
+ * First copy the templates -- we might have the default
196
* config file there, in which case we would want to read
197
* from it after installing.
198
*/
199
copy_templates(template_path);
199
-
200
git_config(git_default_config, NULL);
201
- is_bare_repository_cfg = init_is_bare_repository;
201
203
- /* reading existing config may have overwrote it */
202
+ /*
203
+ * We must make sure command-line options continue to override any
204
+ * values we might have just re-read from the config.
205
+ */
206
+ is_bare_repository_cfg = init_is_bare_repository;
207
if (init_shared_repository != -1)
208
set_shared_repository(init_shared_repository);
209