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

[PATCH v3 0/5] builtin/config: bug fixes for "get" subcommand with "--type=color"

From
Patrick Steinhardt <ps@pks.im>
Date
Sep 18, 2025, 06:14 UTC
Message-ID
<20250918-pks-config-color-v3-0-08ea618cae26@pks.im>
In-Reply-To
<20250911-pks-config-color-v1-0-3a7c79df65b1@pks.im>
Hi,

this small patch series contains two bug fixes for `git config get --type=color`:

  - We restore the behaviour where we can now parse colors without a
    config key.
  - We stop spawning the pager when the user requests to print ANSI
    color escape sequences.

Furthermore, the patch series does some lighter refactorings of t1300. That test file still has its fair share of issues, but at least it looks a bit less dirty now.

Changes in v2:
  - Improve commit messages.
  - Use "\EOF" and "-EOF" in more cases.
  - Move a style fixup from the first commit into the second commit.
  - Link to v1: https://lore.kernel.org/r/20250911-pks-config-color-v1-0-3a7c79df65b1@pks.im
Changes in v3:
  - Provide additional context as part of the commit message for the
    commit that stops setting up the pager with `--type=color`.
  - Link to v2: https://lore.kernel.org/r/20250915-pks-config-color-v2-0-e4290bd8d13c@pks.im
Thanks!
Patrick
---
Patrick Steinhardt (5):
      t1300: write test expectations in the test's body
      t1300: small style fixups
      builtin/config: do not die in `get_color()`
      builtin/config: special-case retrieving colors without a key
      builtin/config: do not spawn pager when printing color codes
 builtin/config.c  |  20 +++-
 t/t1300-config.sh | 349 +++++++++++++++++++++++++++---------------------------
 2 files changed, 187 insertions(+), 182 deletions(-)
Range-diff versus v2:
1:  e61278d7c5 = 1:  fdd1711881 t1300: write test expectations in the test's body
2:  e6f1ea5283 = 2:  8e1e05d9e1 t1300: small style fixups
3:  6f8257aeb4 = 3:  1ef6272e64 builtin/config: do not die in `get_color()`
4:  27a8ab34b0 = 4:  5dcf8c6656 builtin/config: special-case retrieving colors without a key
5:  259600c32a ! 5:  05d5022c1b builtin/config: do not spawn pager when printing color codes
    @@ Commit message
         to reuse the same colors as Git.
     
         Right now though we set up the auto-pager, which means that the string
    -    may instead be written to the pager command. This is of course quite
    -    nonsensical; there shouldn't be any use case where the color code should
    -    end up in the pager instead of in the TTY.
    +    may be written to the pager instead of directly to the terminal. This
    +    behaviour is problematic for two reasons:
     
    -    Fix this by disabling the pager in case the user is asking us to print
    -    color sequences.
    +      - Color codes are meant for direct terminal output; writing them into
    +        a pager does not seem like a sensible thing to do without additional
    +        text.
    +
    +      - It is inconsistent with `git config --get-color`, which never uses a
    +        pager, despite the fact that we claim `git config get --type=color`
    +        to be a drop-in replacement in git-config(1).
    +
    +    Fix this by disabling the pager when outputting color sequences.
     
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
     

--- base-commit: ab427cd991100e94792fce124b0934135abdea4b change-id: 20250911-pks-config-color-e5b8a213e895

Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 22 of 36 in “builtin/config: bug fixes for "get" subcommand with "--type=color"”
  1. 0/5 builtin/config: bug fixes for "get" subcommand with "--type=color"Patrick Steinhardt, Sep 11, 2025
  2. 1/5 t1300: write test expectations in the test's bodyPatrick Steinhardt, Sep 11, 2025
  3. Kristoffer HaugsbakkSep 11, 2025
  4. Patrick SteinhardtSep 15, 2025
  5. 2/5 t1300: small style fixupsPatrick Steinhardt, Sep 11, 2025
  6. 3/5 builtin/config: do not die in `get_color()`Patrick Steinhardt, Sep 11, 2025
  7. 4/5 builtin/config: special-case retrieving colors without a keyPatrick Steinhardt, Sep 11, 2025
  8. Kristoffer HaugsbakkSep 11, 2025
  9. Patrick SteinhardtSep 15, 2025
  10. 5/5 builtin/config: do not spawn pager when printing color codesPatrick Steinhardt, Sep 11, 2025
  11. Kristoffer HaugsbakkSep 11, 2025
  12. 0/5 builtin/config: bug fixes for "get" subcommand with "--type=color"Patrick Steinhardt, Sep 15, 2025
  13. 1/5 t1300: write test expectations in the test's bodyPatrick Steinhardt, Sep 15, 2025
  14. 2/5 t1300: small style fixupsPatrick Steinhardt, Sep 15, 2025
  15. 3/5 builtin/config: do not die in `get_color()`Patrick Steinhardt, Sep 15, 2025
  16. 4/5 builtin/config: special-case retrieving colors without a keyPatrick Steinhardt, Sep 15, 2025
  17. Junio C HamanoSep 15, 2025
  18. 5/5 builtin/config: do not spawn pager when printing color codesPatrick Steinhardt, Sep 15, 2025
  19. Junio C HamanoSep 15, 2025
  20. Kristoffer HaugsbakkSep 16, 2025
  21. Patrick SteinhardtSep 18, 2025
  22. 0/5 builtin/config: bug fixes for "get" subcommand with "--type=color"Patrick Steinhardt, Sep 18, 2025
  23. 1/5 t1300: write test expectations in the test's bodyPatrick Steinhardt, Sep 18, 2025
  24. 2/5 t1300: small style fixupsPatrick Steinhardt, Sep 18, 2025
  25. 3/5 builtin/config: do not die in `get_color()`Patrick Steinhardt, Sep 18, 2025
  26. 4/5 builtin/config: special-case retrieving colors without a keyPatrick Steinhardt, Sep 18, 2025
  27. Junio C HamanoSep 18, 2025
  28. Patrick SteinhardtSep 22, 2025
  29. Junio C HamanoSep 22, 2025
  30. 5/5 builtin/config: do not spawn pager when printing color codesPatrick Steinhardt, Sep 18, 2025
  31. 0/5 builtin/config: bug fixes for "get" subcommand with "--type=color"Patrick Steinhardt, Sep 22, 2025
  32. 1/5 t1300: write test expectations in the test's bodyPatrick Steinhardt, Sep 22, 2025
  33. 2/5 t1300: small style fixupsPatrick Steinhardt, Sep 22, 2025
  34. 3/5 builtin/config: do not die in `get_color()`Patrick Steinhardt, Sep 22, 2025
  35. 4/5 builtin/config: special-case retrieving colors without a keyPatrick Steinhardt, Sep 22, 2025
  36. 5/5 builtin/config: do not spawn pager when printing color codesPatrick Steinhardt, Sep 22, 2025

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.