Subject: Re: [PATCH 12/13] odb: handle changing a repository's commondir

From: Junio C Hamano <[email-masked]>
Date: Thu, 20 Nov 2025 14:06:15 -0800

Patrick Steinhardt <[email-masked]> 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 ...

> -	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.