check-each-commit.sh
1 #!/bin/bash 2 if [[ "$1" = "" ]]; then 3 echo "USAGE: $0 remote/head_branch" 4 echo "eg $0 upstream/master" 5 exit 1 6 fi 7 8 set -e 9 set -x 10 11 if [[ "$(git log --pretty="%H %D" | grep "^[0-9a-f]*.* $1")" = "" ]]; then 12 echo "It seems like the current checked-out commit is not based on $1" 13 exit 1 14 fi 15 16 # Keep build cache ephemeral for this run to avoid long-term disk growth. 17 TMP_GOCACHE=$(mktemp -d -t lnd-check-commit-gocache.XXXXXX) 18 cleanup() { 19 rm -rf "$TMP_GOCACHE" 20 } 21 trap cleanup EXIT 22 export GOCACHE="$TMP_GOCACHE" 23 24 git rebase --exec scripts/check-commit.sh $1