From fc0b99cd626ce5b8697badc125df43c9c78a2a27 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Wed, 25 Mar 2020 18:28:31 -0700 Subject: [PATCH] tools: Apply `set -x` to just the interesting parts of *-pull-request. The Git commands we're invoking to do the real work are useful to print, for transparency to see what's happening and that there's no magic here. The boring shell stuff like `remote=${2:-"upstream"}` is not so helpful, and nor is the rather arcane and in any case read-only command `git diff-index --quiet HEAD`. Those only add noise that obscures the interesting parts. So, move the `set -x` down to when we're done with the boring preparatory stuff and ready to perform the commands that do the work. --- tools/fetch-pull-request | 5 +++-- tools/fetch-rebase-pull-request | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/fetch-pull-request b/tools/fetch-pull-request index bd1b425ade..f85640001c 100755 --- a/tools/fetch-pull-request +++ b/tools/fetch-pull-request @@ -1,16 +1,17 @@ #!/usr/bin/env 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"} + +set -x git fetch "$remote" "pull/$request_id/head" git checkout -B "review-original-${request_id}" git reset --hard FETCH_HEAD diff --git a/tools/fetch-rebase-pull-request b/tools/fetch-rebase-pull-request index 08ddbba6fa..4711f6cb1b 100755 --- a/tools/fetch-rebase-pull-request +++ b/tools/fetch-rebase-pull-request @@ -1,16 +1,17 @@ #!/usr/bin/env 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"} + +set -x git fetch "$remote" "pull/$request_id/head" git checkout -B "review-${request_id}" "$remote/master" git reset --hard FETCH_HEAD