Add script to check whether branch contains tmp commits
This commit is contained in:
parent
660b3b3dcf
commit
b325f14de0
1 changed files with 28 additions and 0 deletions
28
scripts/branch-contains-no-tmp-commits
Normal file
28
scripts/branch-contains-no-tmp-commits
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
COMMIT_RANGE=""
|
||||||
|
|
||||||
|
if [[ $TRAVIS ]]; then
|
||||||
|
if [[ -z "$TRAVIS_COMMIT_RANGE" ]]; then
|
||||||
|
COMMIT_RANGE=HEAD^..HEAD
|
||||||
|
else
|
||||||
|
COMMIT_RANGE=$TRAVIS_COMMIT_RANGE
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
COMMIT_RANGE=$(git merge-base master HEAD)..HEAD
|
||||||
|
fi
|
||||||
|
|
||||||
|
logfreeof() {
|
||||||
|
git log --format="%s" $COMMIT_RANGE |\
|
||||||
|
awk '{print $1}' |\
|
||||||
|
grep -i "$1" && echo "LOG CONTAINS '$1'" && exit 1
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
logfreeof "fixup"
|
||||||
|
logfreeof "squash"
|
||||||
|
logfreeof "wip"
|
||||||
|
logfreeof "tmp"
|
||||||
|
logfreeof "ci skip"
|
||||||
|
|
Loading…
Reference in a new issue