[PATCH] add automatic git hook setting in autogen.sh
Hi, I would like you to review the following patch: https://gerrit.libreoffice.org/5749 To pull it, you can do: git pull ssh://gerrit.libreoffice.org:29418/libmspub refs/changes/49/5749/1 add automatic git hook setting in autogen.sh Change-Id: I95eb02dc2d347337d7b85f85d6459353278fb137 --- A .git-hooks/README A .git-hooks/commit-msg A .git-hooks/post-merge A .git-hooks/pre-commit M autogen.sh 5 files changed, 366 insertions(+), 7 deletions(-) diff --git a/.git-hooks/README b/.git-hooks/README new file mode 100644 index 000..c6612bc --- /dev/null +++ b/.git-hooks/README @@ -0,0 +1,9 @@ +Git hooks are executable scripts you can place in $GIT_DIR/hooks directory to trigger action at certain points. + +There are two groups of these hooks: client side and server side. +The client-side hooks: +are for client operations such as committing and merging. +The server-side hooks: +are for Git server operations such as receiving pushed commits. + +See Also [ http://git-scm.com/book/en/Customizing-Git-Git-Hooks ] \ No newline at end of file diff --git a/.git-hooks/commit-msg b/.git-hooks/commit-msg new file mode 100755 index 000..e3dfe69 --- /dev/null +++ b/.git-hooks/commit-msg @@ -0,0 +1,181 @@ +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by git-commit with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, make this file executable. + +# Uncomment the below to add a Signed-off-by line to the message. +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +base_dir=$(dirname $0) +MSG="$1" + +abort() { +cp $1 $1.save +cat >&2 <'`" ] ; then +abort "$1" "The commit message looks like ChangeLog, please use the git form." +fi + +# Check for whitespace in front of *'s + +if [ -n "`sed '/^#/,$d' $1 | grep '^[[:space:]]\+\*.*:'`" -a -z "`grep '^\*' $1`" ] ; then +abort "$1" "Please don't use whitespace in front of '* file: Description.' entries." +fi + +# Check that lines do not start with '#' (possibly accidental commit, +# such as starting the message with '#ifdef', git commits start with '#'. + +if [ -n "`grep '^#[^[:blank:]]' $1`" ] ; then +abort "$1" "Possible accidental comment in the commit message (leading # without space)." +fi + + +#-- copied gerrit commit-msg hook to handle ChangeId --> +# From Gerrit Code Review 2.3 +# +# 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" + +# 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 + +id=`grep -i '^Change-Id:' "$MSG" | sed -e "s/.*: I//"` +temp_msg=`grep -v -i '^Change-Id:' "$MSG"` +echo "$temp_msg" > "$MSG" + +if test -z "$id" +then +id=`_gen_ChangeId` +fi +perl -e ' +$MSG = shift; +$id = shift; +$CHANGE_ID_AFTER = shift; + +undef $/; +open(I, $MSG); $_ = ; 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-]+: /) { +$haveFooter++; +next; +} +next if /^[ []/; +$startFooter = $line if ($haveFooter && /^\r?$/); +last; +} + +@footer = @message[$startFooter+1..@message]; +
[PATCH] add automatic git hook setting in autogen.sh
Hi, I would like you to review the following patch: https://gerrit.libreoffice.org/5748 To pull it, you can do: git pull ssh://gerrit.libreoffice.org:29418/libvisio refs/changes/48/5748/1 add automatic git hook setting in autogen.sh Change-Id: I95eb02dc2d347337d7b85f85d6459353278fb137 --- A .git-hooks/README A .git-hooks/commit-msg A .git-hooks/post-merge A .git-hooks/pre-commit M autogen.sh 5 files changed, 366 insertions(+), 7 deletions(-) diff --git a/.git-hooks/README b/.git-hooks/README new file mode 100644 index 000..c6612bc --- /dev/null +++ b/.git-hooks/README @@ -0,0 +1,9 @@ +Git hooks are executable scripts you can place in $GIT_DIR/hooks directory to trigger action at certain points. + +There are two groups of these hooks: client side and server side. +The client-side hooks: +are for client operations such as committing and merging. +The server-side hooks: +are for Git server operations such as receiving pushed commits. + +See Also [ http://git-scm.com/book/en/Customizing-Git-Git-Hooks ] \ No newline at end of file diff --git a/.git-hooks/commit-msg b/.git-hooks/commit-msg new file mode 100755 index 000..e3dfe69 --- /dev/null +++ b/.git-hooks/commit-msg @@ -0,0 +1,181 @@ +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by git-commit with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, make this file executable. + +# Uncomment the below to add a Signed-off-by line to the message. +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +base_dir=$(dirname $0) +MSG="$1" + +abort() { +cp $1 $1.save +cat >&2 <'`" ] ; then +abort "$1" "The commit message looks like ChangeLog, please use the git form." +fi + +# Check for whitespace in front of *'s + +if [ -n "`sed '/^#/,$d' $1 | grep '^[[:space:]]\+\*.*:'`" -a -z "`grep '^\*' $1`" ] ; then +abort "$1" "Please don't use whitespace in front of '* file: Description.' entries." +fi + +# Check that lines do not start with '#' (possibly accidental commit, +# such as starting the message with '#ifdef', git commits start with '#'. + +if [ -n "`grep '^#[^[:blank:]]' $1`" ] ; then +abort "$1" "Possible accidental comment in the commit message (leading # without space)." +fi + + +#-- copied gerrit commit-msg hook to handle ChangeId --> +# From Gerrit Code Review 2.3 +# +# 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" + +# 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 + +id=`grep -i '^Change-Id:' "$MSG" | sed -e "s/.*: I//"` +temp_msg=`grep -v -i '^Change-Id:' "$MSG"` +echo "$temp_msg" > "$MSG" + +if test -z "$id" +then +id=`_gen_ChangeId` +fi +perl -e ' +$MSG = shift; +$id = shift; +$CHANGE_ID_AFTER = shift; + +undef $/; +open(I, $MSG); $_ = ; 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-]+: /) { +$haveFooter++; +next; +} +next if /^[ []/; +$startFooter = $line if ($haveFooter && /^\r?$/); +last; +} + +@footer = @message[$startFooter+1..@message]; +
[PATCH] add automatic git hook setting in autogen.sh
Hi, I would like you to review the following patch: https://gerrit.libreoffice.org/5745 To pull it, you can do: git pull ssh://gerrit.libreoffice.org:29418/libcdr refs/changes/45/5745/1 add automatic git hook setting in autogen.sh Change-Id: I95eb02dc2d347337d7b85f85d6459353278fb137 --- A .git-hooks/README A .git-hooks/commit-msg A .git-hooks/post-merge A .git-hooks/pre-commit M autogen.sh 5 files changed, 366 insertions(+), 7 deletions(-) diff --git a/.git-hooks/README b/.git-hooks/README new file mode 100644 index 000..3ddd71a --- /dev/null +++ b/.git-hooks/README @@ -0,0 +1,9 @@ +Git hooks are executable scripts you can place in $GIT_DIR/hooks directory to trigger action at certain points. + +There are two groups of these hooks: client side and server side. +The client-side hooks: +are for client operations such as committing and merging. +The server-side hooks: +are for Git server operations such as receiving pushed commits. + +See Also [ http://git-scm.com/book/en/Customizing-Git-Git-Hooks ] \ No newline at end of file diff --git a/.git-hooks/commit-msg b/.git-hooks/commit-msg new file mode 100755 index 000..e3dfe69 --- /dev/null +++ b/.git-hooks/commit-msg @@ -0,0 +1,181 @@ +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by git-commit with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, make this file executable. + +# Uncomment the below to add a Signed-off-by line to the message. +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +base_dir=$(dirname $0) +MSG="$1" + +abort() { +cp $1 $1.save +cat >&2 <'`" ] ; then +abort "$1" "The commit message looks like ChangeLog, please use the git form." +fi + +# Check for whitespace in front of *'s + +if [ -n "`sed '/^#/,$d' $1 | grep '^[[:space:]]\+\*.*:'`" -a -z "`grep '^\*' $1`" ] ; then +abort "$1" "Please don't use whitespace in front of '* file: Description.' entries." +fi + +# Check that lines do not start with '#' (possibly accidental commit, +# such as starting the message with '#ifdef', git commits start with '#'. + +if [ -n "`grep '^#[^[:blank:]]' $1`" ] ; then +abort "$1" "Possible accidental comment in the commit message (leading # without space)." +fi + + +#-- copied gerrit commit-msg hook to handle ChangeId --> +# From Gerrit Code Review 2.3 +# +# 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" + +# 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 + +id=`grep -i '^Change-Id:' "$MSG" | sed -e "s/.*: I//"` +temp_msg=`grep -v -i '^Change-Id:' "$MSG"` +echo "$temp_msg" > "$MSG" + +if test -z "$id" +then +id=`_gen_ChangeId` +fi +perl -e ' +$MSG = shift; +$id = shift; +$CHANGE_ID_AFTER = shift; + +undef $/; +open(I, $MSG); $_ = ; 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-]+: /) { +$haveFooter++; +next; +} +next if /^[ []/; +$startFooter = $line if ($haveFooter && /^\r?$/); +last; +} + +@footer = @message[$startFooter+1..@message]; +