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

Re: post-receive-email hook with custom_showrev

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Feb 27, 2013, 07:42 UTC
Message-ID
<512DB8D6.9010109@alum.mit.edu>
In-Reply-To
<CA+mfgz1jrSbbZc7+asxfZivemYSvbB3+UxYx4sm3BwLmR0ELEA@mail.gmail.com>
On 02/22/2013 09:57 PM, Adam Mercer wrote:
Show 20 quoted lines
> I'm trying to setup the post-receive-email hook, from contrib, using a
> custom_showrev, from the script I do this by setting hooks.showrev
> 
> # hooks.showrev
> #   The shell command used to format each revision in the email, with
> #   "%s" replaced with the commit id.  Defaults to "git rev-list -1
> #   --pretty %s", displaying the commit id, author, date and log
> #   message.  To list full patches separated by a blank line, you
> #   could set this to "git show -C %s; echo".
> #   To list a gitweb/cgit URL *and* a full patch for each change set, use this:
> #     "t=%s; printf 'http://.../?id=%%s' \$t; echo;echo; git show -C \$t; echo"
> #   Be careful if "..." contains things that will be expanded by shell "eval"
> #   or printf.
> 
> in my repositories config I have showrev set to:
> 
> [hooks]
>         showrev = t=%s; printf
> 'http://server/cgit/repository/commit/?id=%%s' \$t; echo;echo; git
> show -C \$t; echo

If I type that into my .git/config file then type "git config hooks.showrev" I get "bad config file line 7 in .git/config" due to the "\$". I think the quoting in the comment in post-receive-email is written as if it would be passed via the command line to "git config"; i.e.,

    git config hooks.showrev "t=%s; printf 'http://.../?id=%%s' \$t;
echo;echo; git show -C \$t; echo"

Granted, the docs don't make that clear. See git-config(1) for the details of the config file syntax.

Michael
-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
Previous: Adam MercerNext: Adam Mercer
Message 3 of 4 in “post-receive-email hook with custom_showrev”
  1. Adam MercerFeb 22, 2013
  2. Adam MercerFeb 26, 2013
  3. Michael HaggertyFeb 27, 2013
  4. Adam MercerFeb 27, 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.