[X2Go-Commits] [maintenancescripts] 03/03: git/hooks/update-script._check{, +allow-merges}_: use common.sh.

git-admin at x2go.org git-admin at x2go.org
Mon Feb 23 22:44:54 CET 2015


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository maintenancescripts.

commit 1c7cc5dccbd08a0177de12df92b24ef1fc79ecfc
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Mon Feb 23 22:19:52 2015 +0100

    git/hooks/update-script._check{,+allow-merges}_: use common.sh.
---
 git/hooks/update-script._check+allow-merges_ |   92 +-------------------------
 git/hooks/update-script._check_              |   90 +------------------------
 2 files changed, 2 insertions(+), 180 deletions(-)

diff --git a/git/hooks/update-script._check+allow-merges_ b/git/hooks/update-script._check+allow-merges_
index 3be967e..bb906c9 100755
--- a/git/hooks/update-script._check+allow-merges_
+++ b/git/hooks/update-script._check+allow-merges_
@@ -1,96 +1,6 @@
 #!/bin/bash
 
-umask 002
-
-verbose=true
-
-# Default shell globbing messes things up downstream
-GLOBIGNORE=*
-
-function info {
-  $verbose && echo >&2 "-Info-          $1"
-}
-
-function deny {
-  $verbose && echo >&2 "-Deny-          $1"
-  echo deny
-  exit 1
-}
-
-# Only stderr is passed on to the client.
-echoerr () {
-  echo "-Deny-          $@" >&2
-}
-
-# Only stderr is passed on to the client.
-echowarn () {
-  echo "-Warn-          $@" >&2
-}
-
-is_text_file () {
-  rev=$1
-  file=$2
-  info
-  [ -z "$(git show --stat --pretty="format:" $rev -- "$file" | grep "$file *|  Bin.*bytes$")" ]
-}
-
-# Make sure that the log message contains some text.
-check_log_message () {
-  if ! git log -1 --pretty="format:%B" $REVISION | grep "[a-zA-Z0-9]" > /dev/null ; then
-      echoerr "In $REVISION:"
-      echoerr "Your log message is empty."
-      echoerr "Commit aborted, fix the issue and try again."
-      exit 1
-  fi
-}
-
-check_trailing_whitespace () {
-  git diff-tree --diff-filter="A|C|M|R" --name-only -r $REVISION | tail -n +2 | egrep -v '/$|\.diff$|\.patch$' | egrep "$@" | while read file; do
-    if is_text_file $REVISION "$file" 2> /dev/null ; then
-      if git cat-file -p "$REVISION:$file" | grep -e '[  ]$' > /dev/null ; then
-        echowarn "In $REVISION:"
-        echowarn "Trailing whitespace found in $file."
-      fi
-    fi
-  done
-}
-
-check_ending_newline () {
-  git diff-tree --diff-filter="A|C|M|R" --name-only -r $REVISION | tail -n +2 | egrep -v '/$|\.diff$|\.patch$' | egrep "$@" | while read file; do
-    if is_text_file $REVISION "$file" 2> /dev/null ; then
-      if [ `git cat-file -p "$REVISION:$file" | tail -c1 | wc -l` = 0 ]; then
-        echowarn "In $REVISION:"
-        echowarn "$file does not end in a newline."
-      fi
-    fi
-  done
-}
-
-
-check_tabs () {
-  git diff-tree --diff-filter="A|C|M|R" --name-only -r $REVISION | tail -n +2 | egrep -v 'Makefile.*|common.mak|subdir.mak|clean-diff|\.diff|\.patch' | egrep "$@" | while read file; do
-    if is_text_file $REVISION "$file" 2> /dev/null ; then
-      if git cat-file -p "$REVISION:$file" | grep -P '\t' > /dev/null; then
-        echowarn "In $REVISION:"
-        echowarn "Tabs found in $file."
-      fi
-    fi
-  done
-}
-
-check_dos_linebreaks () {
-  git diff-tree --diff-filter="A|C|M|R" --name-only -r $REVISION | tail -n +2 | egrep "$@" | while read file; do
-    if is_text_file $REVISION "$file" 2> /dev/null ; then
-      if  git cat-file -p "$REVISION:$file" | grep -q '^M$' 2> /dev/null; then
-         echoerr "In $REVISION:"
-         echoerr "DOS linebreaks found in $file."
-         echoerr "Commit aborted, fix the issue and try again."
-         exit 1
-      fi
-    fi
-  done
-}
-
+. hooks/common.sh
 
 case "$1" in
   refs/tags/*)
diff --git a/git/hooks/update-script._check_ b/git/hooks/update-script._check_
index c8fd284..7da6fa7 100755
--- a/git/hooks/update-script._check_
+++ b/git/hooks/update-script._check_
@@ -1,94 +1,6 @@
 #!/bin/bash
 
-umask 002
-
-verbose=true
-
-# Default shell globbing messes things up downstream
-GLOBIGNORE=*
-
-function info {
-  $verbose && echo >&2 "-Info-          $1"
-}
-
-function deny {
-  $verbose && echo >&2 "-Deny-          $1"
-  echo deny
-  exit 1
-}
-
-# Only stderr is passed on to the client.
-echoerr () {
-  echo "-Deny-          $@" >&2
-}
-
-# Only stderr is passed on to the client.
-echowarn () {
-  echo "-Warn-          $@" >&2
-}
-
-is_text_file () {
-  rev="$1"
-  file="$2"
-  info
-  [ -z "$(git show --stat --pretty="format:" $rev -- "$file" | grep "$file *|  Bin.*bytes$")" ]
-}
-
-# Make sure that the log message contains some text.
-check_log_message () {
-  if ! git log -1 --pretty="format:%B" $REVISION | grep "[a-zA-Z0-9]" > /dev/null ; then
-      echoerr "In $REVISION:"
-      echoerr "Your log message is empty."
-      echoerr "Commit aborted, fix the issue and try again."
-      exit 1
-  fi
-}
-
-check_trailing_whitespace () {
-  git diff-tree --diff-filter="A|C|M|R" --name-only -r $REVISION | tail -n +2 | egrep -v '/$|\.diff$|\.patch$' | egrep "$@" | while read file; do
-    if is_text_file $REVISION "$file" 2> /dev/null ; then
-      if git cat-file -p "$REVISION:$file" | grep -e '[  ]$' > /dev/null ; then
-        echowarn "In $REVISION:"
-        echowarn "Trailing whitespace found in $file."
-      fi
-    fi
-  done
-}
-
-check_ending_newline () {
-  git diff-tree --diff-filter="A|C|M|R" --name-only -r $REVISION | tail -n +2 | egrep -v '/$|\.diff$|\.patch$' | egrep "$@" | while read file; do
-    if is_text_file $REVISION "$file" 2> /dev/null ; then
-      if [ `git cat-file -p "$REVISION:$file" | tail -c1 | wc -l` = 0 ]; then
-        echowarn "In $REVISION:"
-        echowarn "$file does not end in a newline."
-      fi
-    fi
-  done
-}
-
-
-check_tabs () {
-  git diff-tree --diff-filter="A|C|M|R" --name-only -r $REVISION | tail -n +2 | egrep -v 'Makefile.*|common.mak|subdir.mak|clean-diff|\.diff|\.patch' | egrep "$@" | while read file; do
-    if is_text_file $REVISION "$file" 2> /dev/null ; then
-      if git cat-file -p "$REVISION:$file" | grep -P '\t' > /dev/null; then
-        echowarn "In $REVISION:"
-        echowarn "Tabs found in $file."
-      fi
-    fi
-  done
-}
-
-check_dos_linebreaks () {
-  git diff-tree --diff-filter="A|C|M|R" --name-only -r $REVISION | tail -n +2 | egrep "$@" | while read file; do
-    if is_text_file $REVISION "$file" 2> /dev/null ; then
-      if  git cat-file -p "$REVISION:$file" | grep -q '^M$' 2> /dev/null; then
-         echowarn "In $REVISION:"
-         echowarn "DOS linebreaks found in $file."
-      fi
-    fi
-  done
-}
-
+. hooks/common.sh
 
 case "$1" in
   refs/tags/*)

--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/maintenancescripts.git


More information about the x2go-commits mailing list