git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 0/3] environment: move encoding configs to struct repository

From
Tian Yuchen <a3205153416@gmail.com>
Date
Mar 1, 2026, 20:35 UTC
Message-ID
<20260301203539.1421152-1-a3205153416@gmail.com>
In-Reply-To
<20260228040727.2057192-1-a3205153416@gmail.com>

This is v3 of the series aimed at reducing the global state associated with 'git_commit_encoding' and 'git_log_output_encoding'.

Changes since v2: Based on the invaluable feedback from Phillip Wood, the architectural approach has been fundamentally adjusted. In v2, I attempted to migrate these variables into 'struct repo_settings'. However, since these are eagerly parsed user preferences, deferring them to lazy evaluation broke early validation.

In this v3 series, the variables are migrated directly into 'struct repository'. 

According to the thread Phillip Wood shared, plumbing the repository pointer safely through the 'git_default_config' callback machinery is highly invasive. Many top-level callers pass custom structs via the 'void *cb' pointer so that blindly casting 'cb' to 'struct repository *' results in weird bugs (at least I can't fix them all in one single patch)

Therefore:
1. The variables are parsed directly into 'the_repository' during config 
   parsing to maintain eager validation.
2. However, the entire read/write paths (commit creation and log APIs) are 
   fully plumbed to accept any 'struct repository' instance. 

Future efforts to libify the config machinery itself will only need to update the parser, as the core APIs are now context-aware.

Tian Yuchen (3):
  commit: plumb 'struct repository' into commit creation APIs
  pretty: plumb 'struct repository' into pretty-print APIs
  environment: migrate encoding configs to struct repository
 builtin/am.c          |  6 +++---
 builtin/blame.c       |  2 +-
 builtin/checkout.c    |  4 ++--
 builtin/commit-tree.c |  2 +-
 builtin/commit.c      |  8 ++++----
 builtin/history.c     |  2 +-
 builtin/log.c         |  4 ++--
 builtin/mailinfo.c    |  6 +++---
 builtin/merge.c       |  6 +++---
 builtin/rebase.c      |  2 +-
 builtin/reset.c       |  2 +-
 builtin/rev-list.c    |  4 ++--
 builtin/shortlog.c    |  4 ++--
 builtin/show-branch.c |  2 +-
 builtin/stash.c       | 12 ++++++------
 bundle.c              |  4 ++--
 commit.c              | 20 ++++++++++----------
 commit.h              |  4 ++--
 environment.c         | 19 ++++++++-----------
 environment.h         |  7 ++-----
 log-tree.c            |  6 +++---
 notes-cache.c         |  2 +-
 notes-utils.c         |  2 +-
 pretty.c              |  8 ++++----
 pretty.h              |  4 ++--
 range-diff.c          |  2 +-
 remote-curl.c         |  2 +-
 replay.c              |  4 ++--
 repository.c          |  2 ++
 repository.h          |  5 +++++
 revision.c            | 10 +++++-----
 sequencer.c           | 32 ++++++++++++++++----------------
 submodule.c           |  2 +-
 33 files changed, 101 insertions(+), 100 deletions(-)
-- 
2.43.0
Previous: Tian YuchenNext: Tian Yuchen
Message 6 of 13 in “environment: migrate encoding settings to repo-settings”
  1. environment: migrate encoding settings to repo-settingsTian Yuchen, Feb 28, 2026
  2. 0/3 migrate encoding settings and bubble up repositoryTian Yuchen, Feb 28, 2026
  3. 1/3 environment: migrate encoding settings to repo-settingsTian Yuchen, Feb 28, 2026
  4. 2/3 commit: pass 'struct repository' to commit creation APIsTian Yuchen, Feb 28, 2026
  5. 3/3 pretty: pass 'struct repository' to pretty_print_commit()Tian Yuchen, Feb 28, 2026
  6. 0/3 environment: move encoding configs to struct repositoryTian Yuchen, Mar 1, 2026
  7. 1/3 commit: plumb 'struct repository' into commit creation APIsTian Yuchen, Mar 1, 2026
  8. 2/3 pretty: plumb 'struct repository' into pretty-print APIsTian Yuchen, Mar 1, 2026
  9. 3/3 environment: migrate encoding configs to struct repositoryTian Yuchen, Mar 1, 2026
  10. 0/3 move encoding configs to repo_config_values()Tian Yuchen, Mar 2, 2026
  11. 1/3 commit: plumb 'struct repository' into commit creation APIsTian Yuchen, Mar 2, 2026
  12. 2/3 pretty: plumb 'struct repository' into pretty-print APIsTian Yuchen, Mar 2, 2026
  13. 3/3 environment: migrate encoding configs to repo_config_values()Tian Yuchen, Mar 2, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.