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

Re: Two problems on alias of git

From
Kana Natsuno <kana@whileimautomaton.net>
Date
May 5, 2009, 15:11 UTC
Message-ID
<op.utgptirm6f2obg@i220-99-253-139.s27.a098.ap.plala.or.jp>
In-Reply-To
<m3bpq7oddw.fsf@localhost.localdomain>
On Tue, 05 May 2009 23:03:49 +0900, Jakub Narebski <jnareb@gmail.com> wrote:
Show 11 quoted lines
> I don't know if it is a bug or a feature, but git-config supports
> quoted strings (required if you want to have value which has trailing
> or leading whitespace, or which contains '#' which is beginning of
> comment character).  Inside quoted string you need to escape '"':
>
>    [string]
>         quotes = "quoted \" string ' with # character"
>
> expands as intended.  Perhaps stripping of double quotes
> inside string are artifact of that feature.  Try escaping or
> double escaping quotes: \" or \\\".

Thank you for the information. I've read the source code of git and I confirmed that this stripping is caused by parse_value() in config.c.

And as I changed the old definition
        lr = !$SHELL -c 'n=10; 1="${1:-$n}"; ...' __dummy__

by enclosing all text in double quotes and substituting '"' with '\"' as follows,

	lr = "!$SHELL -c 'n=10; 1=\"${1:-$n}\"; ...' __dummy__"
it works well now.
	$ git config --get alias.lr
	!$SHELL -c 'n=10; 1="${1:-$n}"; if ! [ "${1##[0-9]*}" ...
-- 
To Vim, or not to Vim.
http://whileimautomaton.net/
Previous: Jakub NarebskiNext: Jakub Narebski
Message 3 of 7 in “Two problems on alias of git”
  1. Kana NatsunoMay 5, 2009
  2. Jakub NarebskiMay 5, 2009
  3. Kana NatsunoMay 5, 2009
  4. Jakub NarebskiMay 5, 2009
  5. Kana NatsunoMay 5, 2009
  6. Jakub NarebskiMay 5, 2009
  7. Jeff KingMay 8, 2009

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.