public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
* \b character escapes in CLI usage
@ 2025-02-25 23:44 Yaakov Smith
  2025-02-26  7:38 ` Jeff King
  0 siblings, 1 reply; 15+ messages in thread
From: Yaakov Smith @ 2025-02-25 23:44 UTC (permalink / raw)
  To: git@vger.kernel.org

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 


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2025-02-27 18:40 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-25 23:44 \b character escapes in CLI usage Yaakov Smith
2025-02-26  7:38 ` Jeff King
2025-02-26  8:09   ` Jeff King
2025-02-26 16:02     ` Junio C Hamano
2025-02-26 16:38     ` Kyle Lippincott
2025-02-26 22:06       ` Jeff King
2025-02-26 15:59   ` Junio C Hamano
2025-02-26 23:36   ` brian m. carlson
2025-02-26 23:55     ` Junio C Hamano
2025-02-27  0:03     ` Junio C Hamano
2025-02-27 14:06       ` General output formatting (was: Re: \b character escapes in CLI usage) Marc Branchaud
2025-02-27 17:06         ` General output formatting Junio C Hamano
2025-02-27 17:14           ` Marc Branchaud
2025-02-27 18:40             ` Junio C Hamano
2025-02-27 16:26     ` \b character escapes in CLI usage Phillip Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox