Re: [PATCH 3/7] builtin/init: refactor messy creation of leading directories
flat view
From: Kaartic Sivaraam <hidden>
Date: 2026-09-25 20:21:59
On 9/24/26 14:49, Patrick Steinhardt wrote:
quoted hunk ↗ jump to hunk
diff --git a/builtin/init-db.c b/builtin/init-db.c index 5c22eae2f3..e45268f1ff 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c@@ -131,15 +131,7 @@ int cmd_init_db(int argc, retry: if (chdir(argv[0]) < 0) { if (!mkdir_tried) { - int saved; - /* - * At this point we haven't read any configuration, - * and we know shared_repository should always be 0; - * but just in case we play safe. - */ - saved = repo_settings_get_shared_repository(the_repository); - repo_settings_set_shared_repository(the_repository, 0); - switch (safe_create_leading_directories_const(the_repository, argv[0])) { + switch (safe_create_leading_directories_no_share_const(argv[0])) { case SCLD_OK: case SCLD_PERMS: break;@@ -150,7 +142,7 @@ int cmd_init_db(int argc, die_errno(_("cannot mkdir %s"), argv[0]); break; } - repo_settings_set_shared_repository(the_repository, saved); +
Even though this patch does not aim to do so, we lost a bunch of 'the_repository' references with this change which is nice. The patch also looks good to me. -- Sivaraam