Fix git rpr
Signed-off-by: Emile Vauge <emile@vauge.com>
This commit is contained in:
parent
8d0bacf146
commit
e16f2bb23d
1 changed files with 13 additions and 13 deletions
26
.github/rpr.sh
vendored
26
.github/rpr.sh
vendored
|
@ -4,9 +4,9 @@
|
|||
|
||||
set -e # stop on error
|
||||
|
||||
usage="$(basename "$0") pr -- rebase a Pull Request against current branch"
|
||||
usage="$(basename "$0") pr remote/branch -- rebase a Pull Request against a remote branch"
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
if [ "$#" -ne 2 ]; then
|
||||
echo "Illegal number of parameters"
|
||||
echo "$usage" >&2
|
||||
exit 1
|
||||
|
@ -16,20 +16,20 @@ command -v jq >/dev/null 2>&1 || { echo "I require jq but it's not installed. A
|
|||
|
||||
set -x # echo on
|
||||
|
||||
base=$(git rev-parse --abbrev-ref HEAD)
|
||||
initial=$(git rev-parse --abbrev-ref HEAD)
|
||||
pr=$1
|
||||
base=$2
|
||||
remote=$(curl -s https://api.github.com/repos/containous/traefik/pulls/$pr | jq -r .head.repo.owner.login)
|
||||
branch=$(curl -s https://api.github.com/repos/containous/traefik/pulls/$pr | jq -r .head.ref)
|
||||
|
||||
git checkout $base
|
||||
clean ()
|
||||
{
|
||||
.github/rmpr.sh $pr
|
||||
}
|
||||
|
||||
git remote add $remote git@github.com:$remote/traefik.git
|
||||
git fetch $remote $branch
|
||||
git checkout -t $remote/$branch
|
||||
git rebase origin/$base
|
||||
trap clean EXIT
|
||||
|
||||
.github/cpr.sh $pr
|
||||
|
||||
git rebase $base
|
||||
git push -f $remote $branch
|
||||
|
||||
# clean
|
||||
git checkout $base
|
||||
git branch -D $branch
|
||||
git remote remove $remote
|
Loading…
Add table
Reference in a new issue