From: Jakub Narebski <jnareb@gmail.com>
To: "Kana Natsuno" <kana@whileimautomaton.net>
Cc: git@vger.kernel.org
Subject: Re: Two problems on alias of git
Date: Tue, 5 May 2009 19:01:36 +0200 [thread overview]
Message-ID: <200905051901.38151.jnareb@gmail.com> (raw)
In-Reply-To: <op.utgs86ta6f2obg@i220-99-253-139.s27.a098.ap.plala.or.jp>
On Wed, 5 May 2009 (yes, different timezones), Kana Natsuno wrote:
> On Wed, 06 May 2009 00:42:49 +0900, Jakub Narebski <jnareb@gmail.com> wrote:
> > By the way, you can use continuation-of-line character (end line
> > with '\') and/or can embed newlines using C escape sequence, i.e. "\n".
> >
> > So your code can look like this (although I am not sure it is worth it):
> >
> > [alias]
> > lr = "!$SHELL -c ' \n\
> > n=10; \n\
> > 1=\"${1:-$n}\"; \n\
> > if ! [ \"${1##[0-9]*}\" = \"\" ]; then \n\
> > t=\"$1\"; \n\
> > 1=\"${2:-$n}\"; \n\
> > 2=\"$t\"; \n\
> > fi; \n\
> > git --no-pager l1 --reverse -\"$1\" \"${2:-HEAD}\" \n\
> > ' __dummy__"
>
> Thank you again, I didn't know that. It is better than what I wrote.
By the way, "\n" is there only for nice looking output of git-config
for this variable. For config file you need only to escape end of line.
> > BTW. you need to quote value because it contains comment character '#'
> > in 4th line of script.
>
> Really? As far as I read the code of git, especially parse_value() in config.c,
> it is not necessary to escape '#'s because they are inside of the outermost
> doublequotes and they should not be escaped, because \# is an unknown escape
> sequence and git rejects them. If #s are escaped, it causes an error as follows:
>
> $ git config --get alias.lr
> fatal: bad config file line 29 in /Users/kana/.gitconfig
Errrr... what I meant is that you have to _quote_ value if it contains
comment character, compare
[string]
unquoted = a # b
quoted = "a # b"
not that you have to escape comment character '#'. But I forgot about
the fact that ## in your example is inside quotes anyway.
--
Jakub Narebski
Poland
next prev parent reply other threads:[~2009-05-05 17:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-05 12:42 Two problems on alias of git Kana Natsuno
2009-05-05 14:03 ` Jakub Narebski
2009-05-05 15:11 ` Kana Natsuno
2009-05-05 15:42 ` Jakub Narebski
2009-05-05 16:25 ` Kana Natsuno
2009-05-05 17:01 ` Jakub Narebski [this message]
2009-05-08 9:06 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200905051901.38151.jnareb@gmail.com \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
--cc=kana@whileimautomaton.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).