Created
February 27, 2019 22:04
-
-
Save lsmag/5800c40602d9afd337c7d2f9c1189af1 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
xmain() { | |
local source_branch="$1"; shift | |
local source_commit=$(git merge-base HEAD "$source_branch") | |
git rebase -i \ | |
--exec 'docker-compose run --rm magalu-entregas make lint' \ | |
--exec 'docker-compose run --rm magalu-entregas make test' \ | |
"$source_commit" \ | |
--reschedule-failed-exec | |
} | |
print_help() { | |
echo "foo" | |
} | |
smart_rebase() { | |
local source_branch="$1"; shift | |
local commands="$@" | |
local source_commit=$(git merge-base HEAD "$source_branch") | |
git rebase -i "${commands[@]}" "$source_commit" --reschedule-failed-exec | |
} | |
main() { | |
local commands=() | |
local source_branch="$1"; shift | |
while test $# -gt 0; do | |
case "$1" in | |
-h|--help) | |
print_help | |
exit 0 | |
;; | |
-x|--exec) | |
shift # consume the -x/--exec | |
commands+=(--exec "$1") | |
shift # consume the command itself | |
;; | |
esac | |
done | |
smart_rebase "$source_branch" "${commands[@]}" | |
} | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment