summaryrefslogtreecommitdiffstats
path: root/scripts/branch-contains-no-tmp-commits
blob: 6697330678acaf2e99b4a12b3a96b40293a7c276 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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"