From 443e31e3486f2432c1306925c5780f9fcd5b2664 Mon Sep 17 00:00:00 2001 From: Rohitt Vashishtha Date: Thu, 1 Jun 2017 23:29:52 +0530 Subject: [PATCH] tools: Add script to see PRs as authors intended. --- tools/fetch-pull-request | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 tools/fetch-pull-request diff --git a/tools/fetch-pull-request b/tools/fetch-pull-request new file mode 100755 index 0000000000..c8e3531427 --- /dev/null +++ b/tools/fetch-pull-request @@ -0,0 +1,16 @@ +#!/bin/bash +set -e +set -x + +if ! git diff-index --quiet HEAD; then + set +x + echo "There are uncommitted changes:" + git status --short + echo "Doing nothing to avoid losing your work." + exit 1 +fi +request_id="$1" +remote=${2:-"upstream"} +git fetch "$remote" "pull/$request_id/head" +git checkout -B "review-original-${request_id}" +git reset --hard FETCH_HEAD