2018-12-18 02:08:53 +01:00
|
|
|
#!/usr/bin/env bash
|
2015-12-13 02:06:59 +01:00
|
|
|
set -e
|
|
|
|
|
2017-04-12 04:07:17 +02:00
|
|
|
if ! git diff-index --quiet HEAD; then
|
2017-05-08 19:51:59 +02:00
|
|
|
echo "There are uncommitted changes:"
|
|
|
|
git status --short
|
|
|
|
echo "Doing nothing to avoid losing your work."
|
2017-04-12 04:07:17 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
2020-03-26 02:28:31 +01:00
|
|
|
|
2015-12-13 02:06:59 +01:00
|
|
|
request_id="$1"
|
2016-10-11 20:36:54 +02:00
|
|
|
remote=${2:-"upstream"}
|
2020-03-26 02:28:31 +01:00
|
|
|
|
|
|
|
set -x
|
2016-10-11 20:36:54 +02:00
|
|
|
git fetch "$remote" "pull/$request_id/head"
|
2018-08-03 02:14:49 +02:00
|
|
|
git checkout -B "review-${request_id}" "$remote/master"
|
2015-12-13 02:06:59 +01:00
|
|
|
git reset --hard FETCH_HEAD
|
|
|
|
git pull --rebase
|