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

Re: [PATCH] Add support for a 'pre-push' hook

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 16, 2012, 21:23 UTC
Message-ID
<7vmwyhkzs5.fsf@alter.siamese.dyndns.org>
In-Reply-To
<vpq625547ne.fsf@grenoble-inp.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
Show 12 quoted lines
>> +# hook that fails
>> +mk_hook_fail () {
>> +cat > "$HOOK" <<EOF
>> +#!/bin/sh
>> +exit 1
>> +EOF
>> +chmod +x "$HOOK"
>> +}
>
> I'd add a "touch hook-ran" in the script, a "rm -f hook-ran" before
> launching git-push, and test the file existance after the hook to make
> sure it was ran.

And if you create that "evidence that it did ran" file without using "touch", it would be perfect. Unless you are updating the timestamp of an existing file while preserving the contents of it, it is misleading to use "touch".

All other points in your review are good.  Thanks.
Previous: Matthieu MoyNext: Aske Olsson
Message 3 of 7 in “Add support for a 'pre-push' hook”
  1. Add support for a 'pre-push' hookAske Olsson, Nov 16, 2012
  2. Matthieu MoyNov 16, 2012
  3. Junio C HamanoNov 16, 2012
  4. Aske OlssonNov 17, 2012
  5. Junio C HamanoNov 16, 2012
  6. Michael HaggertyNov 17, 2012
  7. Aske OlssonNov 17, 2012

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.