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

Re: simple example for git hooks

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Sep 2, 2010, 22:49 UTC
Message-ID
<AANLkTimEo=sV=bKHyuQ5Md_7uQ0jAFKx+=dv4+KK+oD7@mail.gmail.com>
In-Reply-To
<i5p96s$u7q$1@dough.gmane.org>
On Thu, Sep 2, 2010 at 22:41, Gelonida <gelonida@gmail.com> wrote:
> Is there any clear documentation about hich git commands I'm allowed to
> use during a trigger script and which ones I can't

It's just a program that's run at a certain point, and its exit status determines if git proceeds.

So you can use any git command, but of course what you might affect what's about to be commited.

For a pre-commit hook (IIRC) you should find the stuff to be commited in the index, finding a list of things that changed from a hook is just a matter of diffing HEAD against the contents of the index then.

Previous: GelonidaNext: Gelonida
Message 2 of 6 in “simple example for git hooks”
  1. GelonidaSep 2, 2010
  2. Ævar Arnfjörð BjarmasonSep 2, 2010
  3. GelonidaSep 2, 2010
  4. Knut FrankeSep 3, 2010
  5. Neal KreitzingerSep 3, 2010
  6. GelonidaSep 5, 2010

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.