Re: [PATCH v2 3/3] docs: replace git_config to repo_config
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 17, 2025, 13:39 UTC
- Message-ID
- <xmqqwmafqrtu.fsf@gitster.g>
- In-Reply-To
- <20250516185516.52311-3-jayatheerthkulkarni2005@gmail.com>
K Jayatheerth <jayatheerthkulkarni2005@gmail.com> writes:
Show 8 quoted lines
> This change updates the example in cmd_psuh to use repo_config and > repo_config_get_string_tmp instead of the global git_config functions. > > While git_config() accesses global configuration via the_repository, > using repo_config() makes use of the repo parameter passed to built-in commands. > This is the preferred pattern in the Git codebase, > as it respects repository-specific configuration (e.g., .git/config) > and avoids relying on global state.
Again, do not start with "I did this, I did that". The reason why you needed to do such things is a lot more important.
Since this document was written, the built-in API has been
updated a few times, but the document was left stale. Adjust to
the current best practices by calling repo_config() on the
repository instance the subcommand implementation receives as a
parameter, instead of calling git_config() that used to be the
common practice.or something like that, perhaps.