[Cmake-commits] CMake branch, hooks, updated. 6d1fe685cb08cba7f1b32e721cb474025bad2e03
cmake-commits at cmake.org
cmake-commits at cmake.org
Tue Jan 4 13:58:26 EST 2011
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, hooks has been updated
via 6d1fe685cb08cba7f1b32e721cb474025bad2e03 (commit)
via c3d0b77f8db7073b32f06ef958a7f92867991e73 (commit)
via f560224524868b4b8ed39fb7e68e3f4474a658ef (commit)
from 125100babc6a0c1f25cb88b7da66c1bbb2a62fdf (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6d1fe685cb08cba7f1b32e721cb474025bad2e03
commit 6d1fe685cb08cba7f1b32e721cb474025bad2e03
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Dec 30 12:13:20 2010 -0500
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu Dec 30 12:13:20 2010 -0500
commit-msg: Allow Change-Id only in footer
Gerrit recognizes the Change-Id line only if it appears in the footer.
diff --git a/commit-msg b/commit-msg
index 5d18c5a..c4d8f06 100755
--- a/commit-msg
+++ b/commit-msg
@@ -79,7 +79,15 @@ msg_second() {
}
msg_rest() {
- false
+ if echo "$line" | grep -q "^Change-Id:"; then
+ state=gerrit
+ fi
+}
+
+msg_gerrit() {
+ test "x$line" = "x" && return
+ echo "$line" | grep -q '^[A-Za-z0-9-][A-Za-z0-9-]*:' && return
+ die 'The Change-Id line must appear in a footer at the bottom.'
}
# Pipe commit message into the state machine.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c3d0b77f8db7073b32f06ef958a7f92867991e73
commit c3d0b77f8db7073b32f06ef958a7f92867991e73
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Dec 30 09:11:38 2010 -0500
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu Dec 30 09:11:38 2010 -0500
pre-commit: Add whitespace check "no-lf-at-eol"
diff --git a/pre-commit b/pre-commit
index 8ecbaab..2493772 100755
--- a/pre-commit
+++ b/pre-commit
@@ -81,6 +81,15 @@ check_tab() {
done
}
+# Reject addition of a line without a newline at end-of-file.
+check_no_lf_at_eof() {
+ lines=$(git diff-index -p --cached $against -- "$1" | tail -2)
+ if echo "$lines" | head -1 | grep -q '^+' &&
+ echo "$lines" | tail -1 | grep -q '^\\ No newline'; then
+ echo "$1: No newline at end of file"
+ fi
+}
+
# Custom whitespace checks.
check_whitespace() {
ws=$(git check-attr whitespace -- "$file" |
@@ -90,6 +99,9 @@ check_whitespace() {
*,tab-in-indent,*) check_tab "$1" ;;
esac
fi
+ case ",$ws," in
+ *,no-lf-at-eof,*) check_no_lf_at_eof "$1" ;;
+ esac
}
bad=$(git diff-index --name-only --cached $against -- |
while read file; do
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f560224524868b4b8ed39fb7e68e3f4474a658ef
commit f560224524868b4b8ed39fb7e68e3f4474a658ef
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Dec 30 09:08:10 2010 -0500
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu Dec 30 09:08:10 2010 -0500
pre-commit: Generalize custom whitespace check
Lookup the whitespace attribute for each modified file and dispatch
custom checks as necessary. Currently the only custom check is the
approximate tab-in-indent check for Git < 1.7.2.
diff --git a/pre-commit b/pre-commit
index 0f71055..8ecbaab 100755
--- a/pre-commit
+++ b/pre-commit
@@ -69,6 +69,8 @@ fi
bad=$(git diff-index --check --cached $against --) || die "$bad"
# Approximate whitespace=tab-in-indent check with Git < 1.7.2.
+git --version | grep -q " \(1\.[0-6]\|1\.7\.[01]\)" &&
+approx_tab_in_indent=true || approx_tab_in_indent=false
check_tab() {
lines=$(git diff-index -p --cached $against -- "$1" |
grep '^+ ') &&
@@ -78,20 +80,22 @@ check_tab() {
echo "$line"
done
}
-approx_tab_in_indent() {
+
+# Custom whitespace checks.
+check_whitespace() {
ws=$(git check-attr whitespace -- "$file" |
sed 's/^[^:]*: whitespace: //')
- case ",$ws," in
- *,tab-in-indent,*) check_tab "$1" ;;
- esac
+ if $approx_tab_in_indent; then
+ case ",$ws," in
+ *,tab-in-indent,*) check_tab "$1" ;;
+ esac
+ fi
}
-if git --version | grep " \(1\.[0-6]\|1\.7\.[01]\)" >/dev/null; then
- bad=$(git diff-index --name-only --cached $against -- |
- while read file; do
- approx_tab_in_indent "$file"
- done)
- test -z "$bad" || die "$bad"
-fi
+bad=$(git diff-index --name-only --cached $against -- |
+while read file; do
+ check_whitespace "$file"
+done)
+test -z "$bad" || die "$bad"
#-----------------------------------------------------------------------------
# Check file modes and sizes.
-----------------------------------------------------------------------
Summary of changes:
commit-msg | 10 +++++++++-
pre-commit | 34 +++++++++++++++++++++++++---------
2 files changed, 34 insertions(+), 10 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list