git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: bill lam <cbill.lam@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: pre-commit hook
Date: Fri, 20 Feb 2009 08:25:52 -0800	[thread overview]
Message-ID: <7v63j5t6r3.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 20090220091127.GA7415@b2j

bill lam <cbill.lam@gmail.com> writes:

> The pre-commit hooks as follows.
>
>  10 # This is slightly modified from Andrew Morton's Perfect Patch.
>  11 # Lines you introduce should not have trailing whitespace.

That's a sample hook from an ancient version of git.  We do not ship that
version anymore since late last June.  You should be able to replace it
with the version shipped with v1.6.0 or later if your git is recent
enough.

    #!/bin/sh
    #
    # An example hook script to verify what is about to be committed.
    # Called by git-commit with no arguments.  The hook should
    # exit with non-zero status after issuing an appropriate message if
    # it wants to stop the commit.
    #
    # To enable this hook, rename this file to "pre-commit".

    if git-rev-parse --verify HEAD 2>/dev/null
    then
            against=HEAD
    else
            # Initial commit: diff against an empty tree object
            against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
    fi

    exec git diff-index --check --cached $against --

Perhaps a time to upgrade?  People should be running at least 1.6.0 these
days ;-).

  reply	other threads:[~2009-02-20 16:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-20  9:11 pre-commit hook bill lam
2009-02-20 16:25 ` Junio C Hamano [this message]
2009-02-21  3:57   ` bill lam
2009-02-21 11:28     ` Michael J Gruber
2009-02-22 10:58       ` bill lam
2009-02-22 11:17         ` Sverre Rabbelier
2009-02-22 14:13           ` bill lam

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=7v63j5t6r3.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=cbill.lam@gmail.com \
    --cc=git@vger.kernel.org \
    /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).