Re: [PATCH 12/13] odb: handle changing a repository's commondir
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 20, 2025, 22:06 UTC
- Message-ID
- <xmqq34687414.fsf@gitster.g>
- In-Reply-To
- <20251119-b4-pks-odb-creation-v1-12-2b2ed2612cb6@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
> -static void set_git_dir_1(const char *path)
> +static void setup_git_env_internal(const char *git_dir,
> + bool skip_initializing_odb)
> +{Hopefully we won't gain too many callers of this function, and ...
> +static void set_git_dir_1(const char *path, bool skip_initializing_odb)
> {... this function, as ...
Show 5 quoted lines
> - set_git_dir_1(path); > + set_git_dir_1(path, true); > ... > - set_git_dir_1(path); > + set_git_dir_1(path, false);
... it is almost impossible to tell from the call site which one is for initializing the ODB (hint: "true" does initialize the ODB, oh, no it is the other way around, or is it correct? now everybody is confused).
We could do "enum { INIT_DB, NO_INIT_DB }" instead of bool and the calling sites would become self-describing, but as long as we won't have too many calling sites, the current code should be OK.