forked from dustin/bindir
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a command to run a script against a sequence of commits.
This is kind of like bisect, but when you want to hit every single version.
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/sh | ||
# Run a command over a sequence of builds. | ||
# Example: | ||
# git test-sequence origin/master.. 'make clean && make test' | ||
|
||
start_branch=`git rev-parse --symbolic-full-name HEAD | sed s,refs/heads/,,` | ||
tmpbranch=test_seq_$$ | ||
|
||
git checkout -b $tmpbranch | ||
|
||
cleanup() { | ||
git checkout $start_branch | ||
git branch -D $tmpbranch | ||
} | ||
|
||
broke_on() { | ||
echo "Broke on $v" | ||
cleanup | ||
exit 1 | ||
} | ||
|
||
for v in `git rev-list --reverse $1` | ||
do | ||
git reset --hard $v && eval "$2" || broke_on $v | ||
done | ||
|
||
cleanup | ||
|
||
echo "All's well." |