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

\b character escapes in CLI usage

From
YSYaakov Smith <yaakov.smith@wisetechglobal.com>
Date
Feb 25, 2025, 23:44 UTC
Message-ID
<SYBPR01MB579278DD5EC6E13CA9A213FDE2C32@SYBPR01MB5792.ausprd01.prod.outlook.com>
Hi all,
I'm not sure if this is a bug, but it definitely feels like a bug.
A colleague of mine was going through the documentation for the git configuration file format and noticed that \b is a permitted escape.
In some places, such as trying to fetch a remote with this in the URL, git will render the character differently.
[remote "backslashb"]
        url = "\b"
        fetch = +refs/heads/*:refs/remotes/backslashb/*

$ git fetch backslashb fatal: '?' does not appear to be a git repository fatal: Could not read from remote repository.

When using "git config --list" however, this is emitted in its raw format, and can be used to mask or hide an actual (probably invalid) value:
$ cat .git/config
[core]
        somevalue = "true\b\b\b\bfalse"
$ git config --local --list
core.somevalue=false
Should "git config" be smarter here and print something other than a literal backspace to the terminal, like "git fetch" does?

[System Info] git version: git version 2.34.1 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Linux 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 compiler info: gnuc: 11.4 libc info: glibc: 2.35 $SHELL (typically, interactive shell): /bin/bash

Kind regards,
Yaakov Smith
Principal Software Engineer
Pronouns: he/him 
e   yaakov.smith@wisetechglobal.com
t    +61 (2) 8001 2200
d   +61 (2) 8986 2753
wisetechglobal.com 

Enabling and empowering the world's supply chains.  This email is subject to our Confidentiality Statement 

Next: Jeff King
Message 1 of 15 in “\b character escapes in CLI usage”
  1. Yaakov SmithFeb 25, 2025
  2. Jeff KingFeb 26, 2025
  3. Jeff KingFeb 26, 2025
  4. Junio C HamanoFeb 26, 2025
  5. Kyle LippincottFeb 26, 2025
  6. Jeff KingFeb 26, 2025
  7. Junio C HamanoFeb 26, 2025
  8. brian m. carlsonFeb 26, 2025
  9. Junio C HamanoFeb 26, 2025
  10. Junio C HamanoFeb 27, 2025
  11. General output formatting (was: Re: \b character escapes in CLI usage)Marc Branchaud, Feb 27, 2025
  12. Junio C HamanoFeb 27, 2025
  13. Marc BranchaudFeb 27, 2025
  14. Junio C HamanoFeb 27, 2025
  15. Phillip WoodFeb 27, 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.