diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2018-04-12 01:10:56 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2018-04-14 00:46:06 +0200 |
commit | b325f14de0684c0d1775e8a9ba490b6d1aee343f (patch) | |
tree | 635ecb008e8b22f868877f8154bea86510a23960 /scripts | |
parent | 660b3b3dcfec6646e6c663e3166c1c305a853cdd (diff) |
Add script to check whether branch contains tmp commits
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/branch-contains-no-tmp-commits | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/scripts/branch-contains-no-tmp-commits b/scripts/branch-contains-no-tmp-commits new file mode 100644 index 00000000..66973306 --- /dev/null +++ b/scripts/branch-contains-no-tmp-commits @@ -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" + |