mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
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.
18 lines
367 B
Bash
Executable File
18 lines
367 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
if ! git diff-index --quiet HEAD; then
|
|
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
|