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

[PATCH v2] update revisions doc for quoting in ':/' notation

From
ryenus <ryenus@gmail.com>
Date
Aug 17, 2017, 06:54 UTC
Message-ID
<CAKkAvax4Coqa6=jT52dpy4SYycfwoN-6kGfoh3QPLJi2-69Orw@mail.gmail.com>

To make sure the `<text>` in `:/<text>` is seen as one search string, one should quote/escape `<text>` properly.

Especially, the example given in the manual `:/fix nasty bug` does not work because of missing quotes when used in shell. A note about quoting/escaping is added along with a working example, however, the original example is left-as-is to be consistent with other examples.

Signed-off-by: ryenus <ryenus@gmail.com>
---
 Documentation/revisions.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Documentation/revisions.txt b/Documentation/revisions.txt
index 61277469c..d2862d55d 100644
--- a/Documentation/revisions.txt
+++ b/Documentation/revisions.txt
@@ -185,7 +185,9 @@ existing tag object.
   e.g. ':/^foo'. The special sequence ':/!' is reserved for modifiers to what
   is matched. ':/!-foo' performs a negative match, while ':/!!foo' matches a
   literal '!' character, followed by 'foo'. Any other sequence beginning with
-  ':/!' is reserved for now.
+  ':/!' is reserved for now. And make sure to quote/escape for the text to be
+  interpreted as the expected search string/pattern, e.g., for a commit whose
+  message matches a literal \'`$`', use `git show :/\\\$` or `git show ':/\$'`.

 '<rev>:<path>', e.g. 'HEAD:README', ':README', 'master:./README'::
   A suffix ':' followed by a path names the blob or tree
-- 
2.14.1
Next: Junio C Hamano
Message 1 of 2 in “update revisions doc for quoting in ':/' notation”
  1. update revisions doc for quoting in ':/' notationryenus, Aug 17, 2017
  2. Junio C HamanoAug 17, 2017

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.