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

Re: [PATCH] fix revisions doc about quoting for ':/' notation

From
Andreas Heiduk <asheiduk@gmail.com>
Date
Aug 16, 2017, 21:15 UTC
Message-ID
<956ccc83-c291-4217-795c-fcef33fac35b@gmail.com>
In-Reply-To
<CAKkAvazj28RR1nHEWNNeZeyE6mpkb3opk6kvrxP6Lau6tcCbJQ@mail.gmail.com>
Am 16.08.2017 um 05:21 schrieb ryenus:
Show 6 quoted lines
> 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. The examples are now corrected, and a
> note about quoting/escaping is added as well.

Right now the documentation describes the syntax as git sees the parameters. This is agnostic of the shell or other UI with their different quoting rules. For example users of fish must quote `rev@{2}`. A GUI might require no quoting at all. In that case `:/"fix nasty bugs"` would be given to git verbatim and hence not find the revision.

Also: Other examples like `HEAD@{5 minutes ago}` need the same quoting.

So my suggestion is to not use quoting in the examples and provide only a hint in the text. Example:

 <rev>{caret}{/<text>}', e.g. 'HEAD^{/fix nasty bug}'::
    A suffix '{caret}' to a revision parameter, followed by a brace
    pair that contains a text led by a slash,
    is the same as the ':/fix nasty bug' syntax below except that
    it returns the youngest matching commit which is reachable from
    the '<rev>' before '{caret}'.
+   Depending on the given text the shell's word splitting rules
+   might require additional quoting.
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 5 in “fix revisions doc about quoting for ':/' notation”
  1. fix revisions doc about quoting for ':/' notationryenus, Aug 16, 2017
  2. Junio C HamanoAug 16, 2017
  3. Andreas HeidukAug 16, 2017
  4. Junio C HamanoAug 16, 2017
  5. ryenusAug 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.