Re: pre-commit hook

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



bill lam <cbill.lam@xxxxxxxxx> 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 ;-).
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux