-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a small script to test multiple branches at once.
- Loading branch information
Showing
1 changed file
with
43 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,43 @@ | ||
#!/bin/sh | ||
|
||
# A small script to test multiple branches at once. | ||
# | ||
# Use this script on your own risk! | ||
# Prerequisite for git actually finding this: export PATH=$PATH:. | ||
# Usage: git test-branches fix-bare-size cache-dbs-info ... | ||
|
||
if [ $# -le 0 ]; then | ||
echo usage: $0 branch... | ||
exit 1 | ||
fi | ||
|
||
success=0 | ||
|
||
git stash && stash=1 | ||
|
||
git checkout master | ||
git fetch | ||
git pull --ff-only | ||
|
||
if [ !$? ]; then | ||
git branch -D test | ||
git checkout -b test | ||
for i in $*; do | ||
git merge -m "Merging $i" $i | ||
if [ $? -ne 0 ]; then | ||
echo "Merge failed for branch $i" | ||
git merge --abort | ||
else | ||
success=1 | ||
fi | ||
done | ||
fi | ||
|
||
if [ $success -eq 0 ]; then | ||
echo "No merges succeeded - reverting to master" | ||
git checkout master | ||
fi | ||
|
||
if [ "x$stash" != "x" ]; then | ||
git stash pop | ||
fi |