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

Re: [PATCH v2] rebase -i: respect core.commentchar

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 12, 2013, 18:21 UTC
Message-ID
<7vip5xgzp6.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20130212175322.GC13501@farnsworth.metanate.com>
John Keeping <john@keeping.me.uk> writes:
Show 14 quoted lines
>> I am not sure if I understand what you meant by "literal backslash
>> blah blah", though.
>
> It turns out that having this in the script works (in bash and dash
> although I haven't checked what Posix has to say about it):
>
>     sed -e "2,$ s/^/\\\/"
>
> and is equivalent to:
>
>     sed -e '2,$ s/^/\\/'
>
> because backslashes that aren't recognised as part of an escape sequence
> are not treated specially.
That's POSIX.  Inside a dq pair:
        \
        The <backslash> shall retain its special meaning as an escape
        character (see Escape Character (Backslash)) only when followed by
        one of the following characters when considered special:
        $   `   "   \   <newline>

So in your example "\\\/", the first backslash escapes the second backslash and together they produce a single backslash, the third backslash is followed by a slash that is not special at all, so it produces a second backslash, and the slash stands for itself, resulting in "\\/".

Previous: John KeepingNext: Junio C Hamano
Message 10 of 13 in “rebase -i: respect core.commentchar”
  1. rebase -i: respect core.commentcharJohn Keeping, Feb 11, 2013
  2. Junio C HamanoFeb 11, 2013
  3. John KeepingFeb 11, 2013
  4. Junio C HamanoFeb 11, 2013
  5. rebase -i: respect core.commentcharJohn Keeping, Feb 11, 2013
  6. Junio C HamanoFeb 12, 2013
  7. John KeepingFeb 12, 2013
  8. Junio C HamanoFeb 12, 2013
  9. John KeepingFeb 12, 2013
  10. Junio C HamanoFeb 12, 2013
  11. Junio C HamanoFeb 12, 2013
  12. John KeepingFeb 12, 2013
  13. Junio C HamanoFeb 12, 2013

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.