mirror of
https://github.com/rclone/rclone.git
synced 2024-11-07 09:04:52 +01:00
bin: add script to test all commits compile for git bisect
This commit is contained in:
parent
78150e82a2
commit
5ef3c988eb
36
bin/test-all-commits-compile.sh
Executable file
36
bin/test-all-commits-compile.sh
Executable file
@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
# This tests rclone compiles for all the commits in the branch
|
||||
#
|
||||
# It assumes that the branch is rebased onto master and checks all the commits from branch root to master
|
||||
#
|
||||
# Adapted from: https://blog.ploeh.dk/2013/10/07/verifying-every-single-commit-in-a-git-branch/
|
||||
|
||||
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
if [ "$BRANCH" = "master" ]; then
|
||||
echo "Don't run on master branch"
|
||||
exit 1
|
||||
fi
|
||||
COMMITS=$(git log --oneline --reverse master.. | cut -d " " -f 1)
|
||||
CODE=0
|
||||
|
||||
for COMMIT in $COMMITS
|
||||
do
|
||||
git checkout $COMMIT
|
||||
|
||||
# run-tests
|
||||
echo "------------------------------------------------------------"
|
||||
go install ./...
|
||||
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo $COMMIT - passed
|
||||
else
|
||||
echo $COMMIT - failed
|
||||
git checkout ${BRANCH}
|
||||
exit
|
||||
fi
|
||||
echo "------------------------------------------------------------"
|
||||
done
|
||||
|
||||
git checkout ${BRANCH}
|
||||
echo "All OK"
|
Loading…
Reference in New Issue
Block a user