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 cb038d0b57fa6d131089066b71a30ad284df3c3c (commit) via 7cd9751649d0bb93bdc7b88f96b840877c202b11 (commit) via 592711ab847bb1c18b10d694d6e5929d1754cece (commit) via 5450a1ecb6c95dfbc87ca8f0bf76d9dfe54a7130 (commit) via 4c5c09042a5aa6139307c9b2e4fc5b0059118866 (commit) from e368fa1290fb1eeb6a0a343f0f73356f852e93f7 (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=cb038d0b57fa6d131089066b71a30ad284df3c3c commit cb038d0b57fa6d131089066b71a30ad284df3c3c Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Aug 30 13:27:14 2010 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Aug 30 13:27:14 2010 -0400 commit-msg: Invoke gerrit/commit-msg if hooks.GerritId=true Add a Gerrit Change-Id header if hooks.GerritId is true. Print help if the option is not set and a remote URL looks like Gerrit. diff --git a/commit-msg b/commit-msg index 19d2d4c..37fa32b 100755 --- a/commit-msg +++ b/commit-msg @@ -79,4 +79,44 @@ cat "$commit_msg" | while IFS='' read line; do msg_$state || break done && -rm -f "$commit_msg" +rm -f "$commit_msg" || exit 1 + +#----------------------------------------------------------------------------- +# Optionally run Gerrit's commit-msg hook to add a Change-Id line. + +gerrit_advice() { + gerrits=$(git config -l |grep '^remote\.[^=]\+url=.*review.*$') + test "x$gerrits" != "x" || return + + echo 'Some config values look like Gerrit Code Review URLs:' + echo '' + echo "$gerrits" | sed 's/^/ /' + echo ' +This hook can automatically add a "Change-Id" footer to commit messages +to make interaction with Gerrit easier. To enable this feature, run + + git config hooks.GerritId true + +Then run "git commit --amend" to fix this commit. Otherwise, run + + git config hooks.GerritId false + +to disable the feature and this message.' +} + +gerrit_error() { + die 'non-bool config value hooks.GerritId = '"$hooks_GerritId" +} + +gerrit_hook() { + "$GIT_DIR/hooks/gerrit/commit-msg" "$@" || + die 'gerrit/commit-msg failed' +} + +hooks_GerritId=$(git config --get hooks.GerritId) +case "$hooks_GerritId" in + 'true') gerrit_hook "$@" ;; + 'false') ;; + '') gerrit_advice ;; + *) gerrit_error ;; +esac http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7cd9751649d0bb93bdc7b88f96b840877c202b11 commit 7cd9751649d0bb93bdc7b88f96b840877c202b11 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Aug 30 13:26:19 2010 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Aug 30 13:26:19 2010 -0400 commit-msg: Simplify newlines in die() calls diff --git a/commit-msg b/commit-msg index 9b881b5..19d2d4c 100755 --- a/commit-msg +++ b/commit-msg @@ -26,7 +26,8 @@ die() { echo '-----------------------' 1>&2 echo '' 1>&2 echo "$@" 1>&2 - echo 'To continue editing, run the command + echo ' +To continue editing, run the command git commit -e -F '"$commit_msg"' (assuming your working directory is at the top).' 1>&2 exit 1 @@ -44,18 +45,15 @@ msg_first() { die 'The first line must be at least 8 characters: -------- '"$line"' --------- -' +--------' elif test $len -gt 78; then die 'The first line may be at most 78 characters: ------------------------------------------------------------------------------ '"$line"' ------------------------------------------------------------------------------- -' +------------------------------------------------------------------------------' elif echo "$line" | grep "^[ ]\|[ ]$" >/dev/null 2>&1; then die 'The first line may not have leading or trailing space: -['"$line"'] -' +['"$line"']' else # first line okay state=second http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=592711ab847bb1c18b10d694d6e5929d1754cece commit 592711ab847bb1c18b10d694d6e5929d1754cece Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Aug 30 13:00:11 2010 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Aug 30 13:00:11 2010 -0400 gerrit/commit-msg: Report added Change-Id diff --git a/gerrit/commit-msg b/gerrit/commit-msg index 336a738..d843020 100755 --- a/gerrit/commit-msg +++ b/gerrit/commit-msg @@ -83,6 +83,7 @@ add_ChangeId() { $_ = join("\n", @message, @footer); open(O, ">$MSG"); print O; close O; ' "$MSG" "$id" "$CHANGE_ID_AFTER" + echo "Added Change-Id: I$id" } _gen_ChangeIdInput() { echo "tree $(git write-tree)" http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5450a1ecb6c95dfbc87ca8f0bf76d9dfe54a7130 commit 5450a1ecb6c95dfbc87ca8f0bf76d9dfe54a7130 Author: Brad King <brad.k...@kitware.com> AuthorDate: Fri Aug 27 16:52:02 2010 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Aug 30 12:58:55 2010 -0400 gerrit/commit-msg: Reference bash in shebang line This script uses bashisms like $() so we need a real bash. diff --git a/gerrit/commit-msg b/gerrit/commit-msg index 0c50f69..336a738 100755 --- a/gerrit/commit-msg +++ b/gerrit/commit-msg @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # From Gerrit Code Review 2.1.5 # # Part of Gerrit Code Review (http://code.google.com/p/gerrit/) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4c5c09042a5aa6139307c9b2e4fc5b0059118866 commit 4c5c09042a5aa6139307c9b2e4fc5b0059118866 Author: Brad King <brad.k...@kitware.com> AuthorDate: Fri Aug 27 16:47:00 2010 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Aug 30 12:58:55 2010 -0400 Add commit-msg hook from Gerrit Code Review Currently the hook is unused but later we will invoke it from the main commit-msg hook. diff --git a/NOTICE b/NOTICE index 6371f07..cd8dcca 100644 --- a/NOTICE +++ b/NOTICE @@ -3,3 +3,6 @@ Copyright 2010 Kitware, Inc. This product includes software developed at Kitware, Inc. (http://www.kitware.com/). + +Portions of this software were developed as part of Gerrit Code Review +(http://code.google.com/p/gerrit/) by The Android Open Source Project. diff --git a/gerrit/commit-msg b/gerrit/commit-msg new file mode 100755 index 0000000..0c50f69 --- /dev/null +++ b/gerrit/commit-msg @@ -0,0 +1,104 @@ +#!/bin/sh +# From Gerrit Code Review 2.1.5 +# +# Part of Gerrit Code Review (http://code.google.com/p/gerrit/) +# +# Copyright (C) 2009 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +CHANGE_ID_AFTER="Bug|Issue" +MSG="$1" + +# Check for, and add if missing, a unique Change-Id +# +add_ChangeId() { + clean_message=$(sed -e ' + /^diff --git a\/.*/{ + s/// + q + } + /^Signed-off-by:/d + /^#/d + ' "$MSG" | git stripspace) + if test -z "$clean_message" + then + return + fi + + if grep -i '^Change-Id:' "$MSG" >/dev/null + then + return + fi + + id=$(_gen_ChangeId) + perl -e ' + $MSG = shift; + $id = shift; + $CHANGE_ID_AFTER = shift; + + undef $/; + open(I, $MSG); $_ = <I>; close I; + s|^diff --git a/.*||ms; + s|^#.*$||mg; + exit unless $_; + + @message = split /\n/; + $haveFooter = 0; + $startFooter = @message; + for($line = @message - 1; $line >= 0; $line--) { + $_ = $message[$line]; + + if (/^[a-zA-Z0-9-]+:/ && !m,^[a-z0-9-]+://,) { + $haveFooter++; + next; + } + next if /^[ []/; + $startFooter = $line if ($haveFooter && /^\r?$/); + last; + } + + @footer = @message[$startfooter+...@message]; + @message = @message[0..$startFooter]; + push(@footer, "") unless @footer; + + for ($line = 0; $line < @footer; $line++) { + $_ = $footer[$line]; + next if /^($CHANGE_ID_AFTER):/i; + last; + } + splice(@footer, $line, 0, "Change-Id: I$id"); + + $_ = join("\n", @message, @footer); + open(O, ">$MSG"); print O; close O; + ' "$MSG" "$id" "$CHANGE_ID_AFTER" +} +_gen_ChangeIdInput() { + echo "tree $(git write-tree)" + if parent=$(git rev-parse HEAD^0 2>/dev/null) + then + echo "parent $parent" + fi + echo "author $(git var GIT_AUTHOR_IDENT)" + echo "committer $(git var GIT_COMMITTER_IDENT)" + echo + printf '%s' "$clean_message" +} +_gen_ChangeId() { + _gen_ChangeIdInput | + git hash-object -t commit --stdin +} + + +add_ChangeId ----------------------------------------------------------------------- Summary of changes: NOTICE | 3 ++ commit-msg | 54 +++++++++++++++++++++++---- gerrit/commit-msg | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 154 insertions(+), 8 deletions(-) create mode 100755 gerrit/commit-msg hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits