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

[PATCH] ls-tree: fix documentation of %x format placeholder

From
René Scharfe <l.s.r@web.de>
Date
Jun 15, 2023, 17:33 UTC
Message-ID
<23e54256-9ad5-e978-d0b8-abb511232fd1@web.de>

ls-tree --format expands %x followed by two hexadecimal digits to the character indicated by that hexadecimal number, e.g.:

   $ git ls-tree --format=%x41 HEAD | head -1
   A
It rejects % followed by a hexadecimal digit, e.g.:
   $ git ls-tree --format=%41 HEAD | head -1
   fatal: bad ls-tree format: element '41' does not start with '('

This functionality is provided by strbuf_expand_literal_cb(), which has not been changed since it was factored out by fd2015b323 (strbuf: separate callback for strbuf_expand:ing literals, 2019-01-28).

Adjust the documentation accordingly.
Signed-off-by: René Scharfe <l.s.r@web.de>
---
 Documentation/git-ls-tree.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-ls-tree.txt b/Documentation/git-ls-tree.txt
index 0240adb8ee..af06ce14ed 100644
--- a/Documentation/git-ls-tree.txt
+++ b/Documentation/git-ls-tree.txt
@@ -86,9 +86,9 @@ OPTIONS
 --format=<format>::
 	A string that interpolates `%(fieldname)` from the result
 	being shown. It also interpolates `%%` to `%`, and
-	`%xx` where `xx` are hex digits interpolates to character
-	with hex code `xx`; for example `%00` interpolates to
-	`\0` (NUL), `%09` to `\t` (TAB) and `%0a` to `\n` (LF).
+	`%xNN` where `NN` are hex digits interpolates to character
+	with hex code `NN`; for example `%x00` interpolates to
+	`\0` (NUL), `%x09` to `\t` (TAB) and `%x0a` to `\n` (LF).
 	When specified, `--format` cannot be combined with other
 	format-altering options, including `--long`, `--name-only`
 	and `--object-only`.
--
2.41.0
Message 1 of 1 in “ls-tree: fix documentation of %x format placeholder”
  1. ls-tree: fix documentation of %x format placeholderRené Scharfe, Jun 15, 2023

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.