#!/bin/bash | |
COMMITS=$(git log --oneline | cut -d " " -f 1) | |
for COMMIT in $COMMITS | |
do | |
git checkout $COMMIT | |
./path/to/script.sh | |
if [ $? -eq 0 ] | |
then | |
echo $COMMIT passed | |
else | |
echo $COMMIT failed | |
fi | |
done | |
git checkout master |
This comment has been minimized.
This comment has been minimized.
./path/to/script can be an absolute path or relative to the current working directory (pwd). $? holds the exit code of the last executed command. So assuming your script exits with a non-zero exit code on failure, the rest will just work. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Thanks! This is really great.
Please excuse my ignorance about bash scripting, but assuming that my test run is another .sh file, how do I run that and check the pass condition?