Skip to content

for-each-ref --format doesn't display ANSI background color '8' anymore. #3712

Closed
@ghost

Description

  • I was not able to find an open or closed issue matching what I'm seeing

Setup

Git version: Git-2.35.1.2 64-bit

$ git --version --build-options

git version 2.35.1.windows.2
cpu: x86_64
built from commit: 5437f0fd368c7faf1a0b5e1fef048232c1f2a3e6
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon

$ cmd.exe /c ver

Microsoft Windows [Version 10.0.19043.1526]

 - What options did you set as part of the installation? Or did you choose the
   defaults?

Editor Option: Notepad++
Custom Editor Path:
Default Branch Option:
Path Option: Cmd
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: CRLFAlways
Bash Terminal Option: ConHost
Git Pull Behavior Option: Merge
Use Credential Manager: Enabled
Performance Tweaks FSCache: Enabled
Enable Symlinks: Disabled
Enable Pseudo Console Support: Disabled
Enable FSMonitor: Disabled

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

The issue I'm observing is terminal agnostic. (Run in cmd and PowerShell).

The test command that I've been using to check this problem is:

git for-each-ref --sort=committerdate refs/heads/ --format="%(color: red 8)%(author)"
  • What did you expect to occur after running these commands?

This should output text with red foreground and a gray background, but the background is no longer present.
This behavior worked in git version 2.25.1.windows.1

2.25.1.windows.1
cpu: x86_64
built from commit: cceb69da75b4906bb04cfb3a2f7f37b12b985ec3
sizeof-long: 4
sizeof-size_t: 8
  • What actually happened instead?

It prints the text out with red foreground and no background (matches the background).

I attempt to work around the issue by supplying a hex color, but it doesn't seem that that works with for-each-ref --format

git for-each-ref --sort=committerdate refs/heads/ --format="%(color: red #808080)%(author)"

Although the hex color does work with something like: git log --format="%C(red #808080)%an%C(reset)")

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions