Re: [Outreachy PATCH] environment: move commit_encoding into repo_config_values
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 21, 2026, 20:44 UTC
- Message-ID
- <xmqq33tyn5qi.fsf@gitster.g>
- In-Reply-To
- <20261021155608.58509-1-okhuomonajayi54@gmail.com>
Okhuomon Ajayi <okhuomonajayi54@gmail.com> writes:
Show 14 quoted lines
> Move i18n.commitEncoding from the global git_commit_encoding variable > into struct repo_config_values. > > Initialize and release the value with the other repository config > values. > > Pass the repository to write_commit_tree(). > > Signed-off-by: Okhuomon Ajayi <okhuomonajayi54@gmail.com> > --- > commit.c | 16 ++++++++++------ > environment.c | 15 +++++++++++---- > environment.h | 4 +++- > 3 files changed, 24 insertions(+), 11 deletions(-)
I am not sure if this change makes sense. The 'git_commit_encoding' variable is declared in 'environment.h' to be globally available and defined in 'environment.c', but its only user is the 'commit.c' file.
I do not think it is worth contaminating the repository configuration with it. Instead, shouldn't we allow the functions that use this global to take a "const char *git_commit_encoding" parameter (instead of a 'repository_config' or a 'repository' structure) and pass it through? The callers may need to query the config subsystem to learn the appropriate encoding for the repository they are working with before calling these functions, but there is no need to pass the entire repository structure down the call graph.
Thanks.