poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Pre-push git hook: Make syntax-check only if needed


From: Tim Rühsen
Subject: Re: [PATCH] Pre-push git hook: Make syntax-check only if needed
Date: Sat, 2 May 2020 18:34:01 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

Pushed.

On 02.05.20 13:07, Jose E. Marchesi wrote:
> 
> Hi Tim.
> OK for master.
> Thanks!
> 
>     Example:
>     Removing branches from remotes doesn't need a syntax-check.
>     
>     2020-05-02  Tim Rühsen  <address@hidden>
>     
>             * etc/git-hooks/pre_push: Make syntax-check only if needed.
>     ---
>      ChangeLog              |  4 ++++
>      etc/git-hooks/pre-push | 29 ++++++++++++++++-------------
>      2 files changed, 20 insertions(+), 13 deletions(-)
>     
>     diff --git a/etc/git-hooks/pre-push b/etc/git-hooks/pre-push
>     index dcfdb837..b7c5d2ff 100755
>     --- a/etc/git-hooks/pre-push
>     +++ b/etc/git-hooks/pre-push
>     @@ -21,23 +21,13 @@
>     
>      remote="$1"
>      url="$2"
>     +do_syntaxcheck=0
>     
>      # This script executes at the top of the git tree.  Try to find the
>      # build directory... but ignore jitter's.
>      builddir=$(dirname "`find . -name config.log | grep -v jitter | head 
> -1`")
>      cd $builddir
>     
>     -echo "Checking syntax... "
>     -out=`make syntax-check`
>     -if test $? != 0; then
>     -  (
>     -  echo "$out" | grep ':'
>     -  echo
>     -  echo "*** Syntax check needs to succeed before pushing is allowed."
>     -  ) >&2
>     -  exit 1
>     -fi
>     -
>      z40=0000000000000000000000000000000000000000
>     
>      while read local_ref local_sha remote_ref remote_sha
>     @@ -56,8 +46,6 @@ do
>                       range="$remote_sha..$local_sha"
>               fi
>     
>     -         echo $range
>     -
>               # Check for ChangeLog being in each commits
>               changelog=`git diff-tree --no-commit-id --name-only -r "$range" 
> | grep '^ChangeLog$'`
>               if [ -z "$changelog" ]; then
>     @@ -72,7 +60,22 @@ do
>                       echo >&2 "Found WIP commit in $local_ref, not pushing"
>                       exit 1
>               fi
>     +
>     +         do_syntaxcheck=1
>       fi
>      done
>     
>     +if [ $do_syntaxcheck != 0 ]; then
>     + echo "Checking syntax... "
>     + out=`make syntax-check`
>     + if test $? != 0; then
>     +         (
>     +         echo "$out" | grep ':'
>     +         echo
>     +         echo "*** Syntax check needs to succeed before pushing is 
> allowed."
>     +         ) >&2
>     +         exit 1
>     + fi
>     +fi
>     +
>      exit 0
>     --
>     2.26.2
> 

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]