Commit Graph

8 Commits

Author SHA1 Message Date
Brad King
7827726e88 pre-commit: Check file modes
Check new files and files whose mode changes to verify that each file
mode matches the content of the file.  The mode of a file must be
executable if and only if the file looks executable (name ends in a
Windows executable extension or content starts with a shebang line).
2010-05-20 11:42:57 -04:00
Brad King
7cd6238240 commit-msg: Exclude diff during "git commit -v"
Stop processing the commit message text at a "diff --git" line.  Such
lines occur when the user commits with the "-v" option.  We should not
check the patch content; it will be stripped by Git anyway.
2010-04-28 13:35:19 -04:00
Brad King
0df83855da pre-commit: Workaround shell syntax limitations
Commit "Reject leading TABs" added use of shell syntax of the form

  $(case "..." in
     a) ... ;;
    esac)

Some shell implementations fail to recognize that the ')' in the case
label is not the end of the '$(' expression.  Work around the problem
by moving the case block into a separate function outside the '$()'
expression.
2010-04-27 13:55:31 -04:00
Brad King
f226aad5a4 pre-commit: Reject leading TABs
Our style guidelines do not permit indentation by TABs.
2010-04-23 15:49:21 -04:00
Brad King
5395049e7f commit-msg: Preserve bad message for user to fix
Store a backup copy of the input message.  Remove the backup only on
success.  On failure, tell the user how to use and edit the message
without having to enter it from scratch.
2010-04-22 11:42:15 -04:00
Brad King
2b3a3cd7a6 pre-commit: Validate user.name and user.email 2010-04-20 11:28:25 -04:00
Brad King
8f96d67507 Teach Git to ignore sample hooks 2010-04-01 15:33:56 -04:00
Brad King
68d1d3b4af Prototype pre-commit and commit-msg hook scripts
These hooks perform some basic commit-time checks to keep history clean.
2010-03-31 17:39:00 -04:00