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

Re: [PATCH] completion: suppress unwanted unescaping of `read`

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Apr 24, 2023, 13:52 UTC
Message-ID
<6446898cd2dc3_aba294be@chronos.notmuch>
In-Reply-To
<20230420223800.1698197-1-myoga.murase@gmail.com>
Koichi Murase wrote:
Show 11 quoted lines
> From: Edwin Kofler <edwin@kofler.dev>
> 
> The function `__git_eread`, which reads the first line from the file,
> calls the `read` builtin without passing the flag option `-r`.  When
> the `read` builtin is called without the flag `-r`, it processes the
> backslash escaping in the text that it reads.  For this reason, it is
> generally considered the best practice to always use the `read`
> builtin with flag `-r` unless one intensionally processes the
> backslash escaping.  For the present case in git-prompt.sh, in fact,
> all the occurrences of the calls of `__git_eread` intend to read the
> literal content of the first lines.
This is my undrstanding.
I agree using `-r` is a good practice.
Show 5 quoted lines
> To make it read the first line literally, pass the flag `-r` to the
> `read` builtin in the function `__git_eread`.
> 
> Signed-off-by: Edwin Kofler <edwin@kofler.dev>
> Signed-off-by: Koichi Murase <myoga.murase@gmail.com>
Acked-by: Felipe Contreras <felipe.contreras@gmail.com>
-- 
Felipe Contreras
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 10 in “completion: quote arguments of test and [”
  1. 1/2 completion: quote arguments of test and [Koichi Murase, Apr 20, 2023
  2. 2/2 completion: suppress unwanted unescaping of `read`Koichi Murase, Apr 20, 2023
  3. Junio C HamanoApr 20, 2023
  4. Koichi MuraseApr 20, 2023
  5. completion: suppress unwanted unescaping of `read`Koichi Murase, Apr 20, 2023
  6. Junio C HamanoApr 20, 2023
  7. Felipe ContrerasApr 24, 2023
  8. Junio C HamanoApr 20, 2023
  9. Koichi MuraseApr 20, 2023
  10. Felipe ContrerasApr 24, 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.