precommit.sh 351 字节
Newer Older
L
Luo Tao 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/bin/bash
function abort(){
    echo "Your commit not fit PaddlePaddle code style" 1>&2
    echo "Please use pre-commit scripts to auto-format your code" 1>&2
    exit 1
}

trap 'abort' 0
set -e
cd `dirname $0`
cd ..
export PATH=/usr/bin:$PATH
pre-commit install

if ! pre-commit run -a ; then
Y
Yu Yang 已提交
16
  ls -lh
L
Luo Tao 已提交
17
  git diff  --exit-code
Y
Yu Yang 已提交
18
  exit 1
L
Luo Tao 已提交
19 20 21
fi

trap : 0