From 2cd07f67095a28b34ca3e55a8f251cf313bcfb3e Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sat, 10 May 2025 17:47:21 -0700 Subject: [PATCH 1/5] Reformat --- .github/workflows/style.yml | 4 +-- Makefile | 11 ++++-- ediff-merge-script | 41 +++++++++++----------- git-authors | 68 ++++++++++++++++++------------------- git-clone-related | 56 +++++++++++++++++------------- git-find-branch | 8 ++--- git-find-fork | 15 ++++---- resolve-adjacent-conflicts | 10 +++--- resolve-blank-lines | 6 ++-- resolve-import-conflicts | 6 ++-- 10 files changed, 117 insertions(+), 108 deletions(-) diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index 895a69f..f99dc9e 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -14,11 +14,11 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.11.5' + python-version: '3.13.3' - run: python --version - name: Install Python programs run: pip install ruff - name: Install shellcheck and checkbashisms - run: sudo apt install shellcheck devscripts + run: sudo apt install shfmt shellcheck devscripts - name: Check style run: make check-style diff --git a/Makefile b/Makefile index b71dbb7..93f9f83 100644 --- a/Makefile +++ b/Makefile @@ -21,9 +21,14 @@ check-python-style: SH_SCRIPTS = $(shell grep -r -l '^\#!/bin/sh' * | grep -v .git | grep -v "~" | grep -v cronic-orig) BASH_SCRIPTS = $(shell grep -r -l '^\#!/bin/bash' * | grep -v .git | grep -v "~" | grep -v cronic-orig) -shell-script-style: - shellcheck --format=gcc ${SH_SCRIPTS} ${BASH_SCRIPTS} - checkbashisms ${SH_SCRIPTS} +shell-style-fix: + shfmt -w -i 2 -ci -bn ${SH_SCRIPTS} ${BASH_SCRIPTS} + shellcheck -x -P SCRIPTDIR --format=diff ${SH_SCRIPTS} ${BASH_SCRIPTS} | patch -p1 + +shell-style-check: + shfmt -d -i 2 -ci -bn ${SH_SCRIPTS} ${BASH_SCRIPTS} + shellcheck -x -P SCRIPTDIR --format=gcc ${SH_SCRIPTS} ${BASH_SCRIPTS} + checkbashisms -l ${SH_SCRIPTS} /dev/null showvars: @echo "PYTHON_FILES=${PYTHON_FILES}" diff --git a/ediff-merge-script b/ediff-merge-script index 3165912..50165fe 100755 --- a/ediff-merge-script +++ b/ediff-merge-script @@ -16,19 +16,17 @@ _EMACSCLIENT=emacs # _EMACSCLIENT=emacsclient - # This script is originally from # http://stackoverflow.com/questions/1817370/using-ediff-as-git-mergetool # I have extended so it handles both emacs and emacsclient, # and made other improvements. - # test args if [ ! ${#} -ge 3 ]; then - echo 1>&2 "Error: ${0} requires 4 arguments, got ${#}" - echo 1>&2 "Usage: ${0} LOCAL REMOTE MERGED BASE" - echo 1>&2 " (LOCAL, REMOTE, MERGED, BASE can be provided by \`git mergetool'.)" - exit 1 + echo 1>&2 "Error: ${0} requires 4 arguments, got ${#}" + echo 1>&2 "Usage: ${0} LOCAL REMOTE MERGED BASE" + echo 1>&2 " (LOCAL, REMOTE, MERGED, BASE can be provided by \`git mergetool'.)" + exit 1 fi # tools @@ -41,13 +39,13 @@ _MKTEMP="/bin/mktemp" _LOCAL=${1} _REMOTE=${2} _MERGED=${3} -if [ -r "${4}" ] ; then - _BASE=${4} - _EDIFF=ediff-merge-files-with-ancestor - _EVAL="(${_EDIFF} \"${_LOCAL}\" \"${_REMOTE}\" \"${_BASE}\" nil \"${_MERGED}\")" +if [ -r "${4}" ]; then + _BASE=${4} + _EDIFF=ediff-merge-files-with-ancestor + _EVAL="(${_EDIFF} \"${_LOCAL}\" \"${_REMOTE}\" \"${_BASE}\" nil \"${_MERGED}\")" else - _EDIFF=ediff-merge-files - _EVAL="(${_EDIFF} \"${_LOCAL}\" \"${_REMOTE}\" nil \"${_MERGED}\")" + _EDIFF=ediff-merge-files + _EVAL="(${_EDIFF} \"${_LOCAL}\" \"${_REMOTE}\" nil \"${_MERGED}\")" fi _EVAL_PREFIX="(defun ediff-write-merge-buffer ()\ @@ -62,10 +60,10 @@ if [[ $_EMACSCLIENT == *"emacsclient"* ]]; then ## emacsclient only, not emacs # console vs. X if [ "${TERM}" = "linux" ]; then - unset DISPLAY - _EMACSCLIENTOPTS='-t -a \"\"' + unset DISPLAY + _EMACSCLIENTOPTS='-t -a \"\"' else - _EMACSCLIENTOPTS="-c -a \"\"" + _EMACSCLIENTOPTS="-c -a \"\"" fi else ## emacs only, not emacsclient @@ -77,15 +75,14 @@ fi # echo "${_EMACSCLIENT}" "${_EMACSCLIENTOPTS}" --eval "(progn ${_EVAL_PREFIX} ${_EVAL_PREFIX2} ${_EVAL})" "${_EMACSCLIENT}" "${_EMACSCLIENTOPTS}" --eval "(progn ${_EVAL_PREFIX} ${_EVAL_PREFIX2} ${_EVAL})" 2>&1 - # check modified file if [ ! "$("${_EGREP}" -c '^(<<<<<<<|=======|>>>>>>>|####### Ancestor)$' "${_MERGED}")" = 0 ]; then - _MERGEDSAVE=$(${_MKTEMP} --tmpdir "$(${_BASENAME} "${_MERGED}").XXXXXXXXXX") - ${_CP} "${_MERGED}" "${_MERGEDSAVE}" - echo 1>&2 "Oops! Conflict markers detected in $_MERGED." - echo 1>&2 "Saved your changes to ${_MERGEDSAVE}" - echo 1>&2 "Exiting with code 1." - exit 1 + _MERGEDSAVE=$(${_MKTEMP} --tmpdir "$(${_BASENAME} "${_MERGED}").XXXXXXXXXX") + ${_CP} "${_MERGED}" "${_MERGEDSAVE}" + echo 1>&2 "Oops! Conflict markers detected in $_MERGED." + echo 1>&2 "Saved your changes to ${_MERGEDSAVE}" + echo 1>&2 "Exiting with code 1." + exit 1 fi # It would not be appropriate for this script to do the merge, because diff --git a/git-authors b/git-authors index 3a4163f..52dd988 100755 --- a/git-authors +++ b/git-authors @@ -11,31 +11,31 @@ # --texinfo Use Texinfo escape sequences for accented characters while :; do - case $1 in - --punctuation) - punctuation=1 - ;; - --html) - html=1 - ;; - --latex) - latex=1 - ;; - --texinfo) - texinfo=1 - ;; - --) # End of all options. - shift - break - ;; - -?*) - printf 'WARN: Unknown option (ignored): %s\n' "$1" >&2 - ;; - *) # Default case: No more options, so break out of the loop. - break - esac + case $1 in + --punctuation) + punctuation=1 + ;; + --html) + html=1 + ;; + --latex) + latex=1 + ;; + --texinfo) + texinfo=1 + ;; + --) # End of all options. + shift + break + ;; + -?*) + printf 'WARN: Unknown option (ignored): %s\n' "$1" >&2 + ;; + *) # Default case: No more options, so break out of the loop. + break ;; + esac - shift + shift done # shellcheck disable=SC2091 # Result is "true" or "false", surround with $(...) to interpret it. @@ -44,13 +44,13 @@ if $(git rev-parse --is-shallow-repository); then git fetch --unshallow --quiet fi # shellcheck disable=SC2015 # sed won't fail. -git log | grep '^\(Author\| Co-authored-by\):' | \ - sed -E 's/(Author| Co-authored-by): (.*)/\2/' | sed -E 's/(.*) <.*>/\1/' | \ - grep -v '^renovate\[bot\]$' | \ - LC_ALL=C sort -u | \ - sed -f "$(dirname "$0")"/git-authors.sed | LC_ALL=C sort -u | \ - ( [ -n "${html+x}" ] && sed -e "s/á/\\á/" -e "s/é/\\é/" -e "s/ß/\\ß/" || cat ) | \ - ( [ -n "${latex+x}" ] && sed -e "s/á/\\\\'a/" -e "s/é/\\\\'e/" -e "s/ß/\\\\ss /" || cat ) | \ - ( [ -n "${texinfo+x}" ] && sed -e "s/á/@'a/" -e "s/é/@'e/" -e "s/ß/@ss /" || cat ) | \ - ( [ -n "${punctuation+x}" ] && sed -e 's/$/,/' -e '$ s/,$/./' || cat ) | \ - cat +git log | grep '^\(Author\| Co-authored-by\):' \ + | sed -E 's/(Author| Co-authored-by): (.*)/\2/' | sed -E 's/(.*) <.*>/\1/' \ + | grep -v '^renovate\[bot\]$' \ + | LC_ALL=C sort -u \ + | sed -f "$(dirname "$0")"/git-authors.sed | LC_ALL=C sort -u \ + | ([ -n "${html+x}" ] && sed -e "s/á/\\á/" -e "s/é/\\é/" -e "s/ß/\\ß/" || cat) \ + | ([ -n "${latex+x}" ] && sed -e "s/á/\\\\'a/" -e "s/é/\\\\'e/" -e "s/ß/\\\\ss /" || cat) \ + | ([ -n "${texinfo+x}" ] && sed -e "s/á/@'a/" -e "s/é/@'e/" -e "s/ß/@ss /" || cat) \ + | ([ -n "${punctuation+x}" ] && sed -e 's/$/,/' -e '$ s/,$/./' || cat) \ + | cat diff --git a/git-clone-related b/git-clone-related index 3090719..bf29669 100755 --- a/git-clone-related +++ b/git-clone-related @@ -43,14 +43,14 @@ # Fail if any command fails. set +e -if [ "$1" = "--debug" ] ; then +if [ "$1" = "--debug" ]; then DEBUG=1 shift set -x fi # FALLBACK_BRANCH may be unset. -if [ "$1" = "--upstream-branch" ] ; then +if [ "$1" = "--upstream-branch" ]; then shift FALLBACK_BRANCH=$1 shift @@ -61,13 +61,19 @@ if [ "$#" -lt 2 ]; then exit 1 fi -beginswith() { case $2 in "$1"*) true;; *) false;; esac; } +beginswith() { case $2 in "$1"*) true ;; *) false ;; esac } -UPSTREAM_ORG=$1; shift -REPO_NAME=$1; shift +UPSTREAM_ORG=$1 +shift +REPO_NAME=$1 +shift if [ "$#" -ne 0 ] && ! beginswith "-" "$1"; then - DESTINATION=$1; shift - if [ -d "$DESTINATION" ] && [ "$(pwd -P)" = "$(cd "$DESTINATION"; pwd -P)" ]; then + DESTINATION=$1 + shift + if [ -d "$DESTINATION" ] && [ "$(pwd -P)" = "$( + cd "$DESTINATION" + pwd -P + )" ]; then echo "git-clone-related: destination is same as current directory" exit 1 fi @@ -82,7 +88,7 @@ if [ "$#" -eq 0 ]; then set -- -q --single-branch --depth 1 fi -if [ -n "$DEBUG" ] ; then +if [ -n "$DEBUG" ]; then echo "Entering git-clone-related $UPSTREAM_ORG $REPO_NAME $DESTINATION $*" fi @@ -101,21 +107,21 @@ else SCRIPTDIR="$(cd "$(dirname "$0")" && pwd -P)" CI_INFO="$SCRIPTDIR/../plume-scripts/ci-info" - if [ ! -f "$CI_INFO" ] ; then + if [ ! -f "$CI_INFO" ]; then CI_INFO="$SCRIPTDIR/../.plume-scripts/ci-info" fi - if [ ! -f "$CI_INFO" ] ; then + if [ ! -f "$CI_INFO" ]; then CI_INFO="$SCRIPTDIR/.plume-scripts/ci-info" fi - if [ ! -f "$CI_INFO" ] ; then + if [ ! -f "$CI_INFO" ]; then (cd "$SCRIPTDIR" && git clone --depth 1 https://github.com/plume-lib/plume-scripts .plume-scripts) fi - if [ ! -f "$CI_INFO" ] ; then + if [ ! -f "$CI_INFO" ]; then echo "CI_INFO does not exist: $CI_INFO" exit 1 fi - if [ -n "$DEBUG" ] ; then + if [ -n "$DEBUG" ]; then echo "About to run ci-info --debug" "${CI_INFO}" --debug "${UPSTREAM_ORG}" echo "Ran ci-info --debug" @@ -123,27 +129,27 @@ else fi eval "$("${CI_INFO}" "${UPSTREAM_ORG}")" - if [ -n "$DEBUG" ] ; then + if [ -n "$DEBUG" ]; then echo "Finished running ci-info" fi UPSTREAM_REPO_URL="https://github.com/${UPSTREAM_ORG}/${REPO_NAME}.git" - if [ -n "$DEBUG" ] ; then + if [ -n "$DEBUG" ]; then echo "About to run git-find-fork" "${CI_ORGANIZATION}" "${UPSTREAM_ORG}" "${REPO_NAME}" fi # REPO_URL is what will be cloned. It might be the same as UPSTREAM_REPO_URL. REPO_URL=$("${SCRIPTDIR}"/git-find-fork "${CI_ORGANIZATION}" "${UPSTREAM_ORG}" "${REPO_NAME}") - if [ -n "$DEBUG" ] ; then + if [ -n "$DEBUG" ]; then echo "git-find-fork ${CI_ORGANIZATION} ${UPSTREAM_ORG} ${REPO_NAME} => ${REPO_URL}" fi - if [ -n "$DEBUG" ] ; then + if [ -n "$DEBUG" ]; then echo "About to run git-find-branch" "${REPO_URL}" "${CI_BRANCH_NAME}" ${FALLBACK_BRANCH:+"$FALLBACK_BRANCH"} fi REPO_BRANCH=$("${SCRIPTDIR}"/git-find-branch "${REPO_URL}" "${CI_BRANCH_NAME}" ${FALLBACK_BRANCH:+"$FALLBACK_BRANCH"}) - if [ -n "$DEBUG" ] ; then + if [ -n "$DEBUG" ]; then echo "git-find-branch ${REPO_URL} ${CI_BRANCH_NAME} => ${REPO_BRANCH}" fi - if [ "$UPSTREAM_REPO_URL" != "$REPO_URL" ] && [ "$REPO_BRANCH" != "$CI_BRANCH_NAME" ] ; then + if [ "$UPSTREAM_REPO_URL" != "$REPO_URL" ] && [ "$REPO_BRANCH" != "$CI_BRANCH_NAME" ]; then ## Don't use the fallback branch (e.g., master) of the downstream repo REPO_URL="$UPSTREAM_REPO_URL" REPO_BRANCH=$("${SCRIPTDIR}"/git-find-branch "${REPO_URL}" "${CI_BRANCH_NAME}" ${FALLBACK_BRANCH:+"$FALLBACK_BRANCH"}) @@ -152,10 +158,12 @@ else # Try twice in case of network lossage. timeout 60 git clone --depth 1 -b "${REPO_BRANCH}" "$@" "${REPO_URL}" "${DESTINATION}" \ || { echo "Retrying 'git clone ... ${REPO_URL} ${DESTINATION}' after timeout" \ - && rm -rf "${DESTINATION}" \ - && sleep 60 \ - && { timeout 60 git clone --depth 1 -b "${REPO_BRANCH}" "$@" "${REPO_URL}" "${DESTINATION}" \ - || { echo "git-clone-related: failed: git clone --depth 1 -b ${REPO_BRANCH}" "$@" "${REPO_URL} ${DESTINATION}"; - exit 2; } } } + && rm -rf "${DESTINATION}" \ + && sleep 60 \ + && { timeout 60 git clone --depth 1 -b "${REPO_BRANCH}" "$@" "${REPO_URL}" "${DESTINATION}" \ + || { + echo "git-clone-related: failed: git clone --depth 1 -b ${REPO_BRANCH}" "$@" "${REPO_URL} ${DESTINATION}" + exit 2 + }; }; } fi echo "git-clone-related: ${DESTINATION} is at $(cd "${DESTINATION}" && git rev-parse HEAD)" diff --git a/git-find-branch b/git-find-branch index 5458410..7d4ce89 100755 --- a/git-find-branch +++ b/git-find-branch @@ -10,10 +10,10 @@ REPO_URL=$1 shift for BRANCH in "$@"; do - if (git ls-remote --quiet --exit-code --heads "${REPO_URL}" "${BRANCH}" > /dev/null) ; then - echo "${BRANCH}" - exit 0 - fi + if (git ls-remote --quiet --exit-code --heads "${REPO_URL}" "${BRANCH}" >/dev/null); then + echo "${BRANCH}" + exit 0 + fi done git ls-remote --symref "${REPO_URL}" HEAD | awk '/^ref:/ {sub(/refs\/heads\//, "", $2); print $2}' diff --git a/git-find-fork b/git-find-fork index 7bdd825..54b159d 100755 --- a/git-find-fork +++ b/git-find-fork @@ -10,10 +10,10 @@ # Often, you can use the `git-clone-related` script instead of this one. if [ "$#" -ne 3 ]; then - script=$(basename -- "$0") - >&2 echo "Error: $script requires 3 arguments, got $#" - >&2 echo "Usage: $script ORG UPSTREAM_ORG REPONAME" - exit 1 + script=$(basename -- "$0") + >&2 echo "Error: $script requires 3 arguments, got $#" + >&2 echo "Usage: $script ORG UPSTREAM_ORG REPONAME" + exit 1 fi ORG=$1 @@ -25,10 +25,9 @@ REPONAME=$3 # export GITEXISTS="git ls-remote" export GITEXISTS="wget -q --spider" - -if ( ${GITEXISTS} "https://github.com/${ORG}/${REPONAME}.git" > /dev/null ); then - OWNER="${ORG}" +if (${GITEXISTS} "https://github.com/${ORG}/${REPONAME}.git" >/dev/null); then + OWNER="${ORG}" else - OWNER="${UPSTREAM_ORG}" + OWNER="${UPSTREAM_ORG}" fi echo "https://github.com/${OWNER}/${REPONAME}.git" diff --git a/resolve-adjacent-conflicts b/resolve-adjacent-conflicts index cf73382..ca47823 100755 --- a/resolve-adjacent-conflicts +++ b/resolve-adjacent-conflicts @@ -38,7 +38,7 @@ echo "which is an obsolete version in https://github.com/plume-lib/git-scripts . DEBUG=0 -if [ "$#" -eq 0 ] ; then +if [ "$#" -eq 0 ]; then readarray -t files < <(grep -l -r '^<<<<<<< HEAD' .) else files=("$@") @@ -48,15 +48,15 @@ SCRIPTDIR="$(cd "$(dirname "$0")" && pwd -P)" status=0 -for file in "${files[@]}" ; do - if [ "$DEBUG" ] ; then +for file in "${files[@]}"; do + if [ "$DEBUG" ]; then echo "before resolve-conflicts.py: $(sha256sum "$file")" cat "$file" fi - if ! "${SCRIPTDIR}"/resolve-conflicts.py --adjacent_lines "$file" ; then + if ! "${SCRIPTDIR}"/resolve-conflicts.py --adjacent_lines "$file"; then status=1 fi - if [ "$DEBUG" ] ; then + if [ "$DEBUG" ]; then echo "after resolve-conflicts.py: (status=$status: $(sha256sum "$file")" cat "$file" fi diff --git a/resolve-blank-lines b/resolve-blank-lines index 96656b9..2cac5cc 100755 --- a/resolve-blank-lines +++ b/resolve-blank-lines @@ -23,7 +23,7 @@ # `git diff` has a `--ignore-blank-lines` option, but `git merge` has # no option for ignoring blank lines. This script addresses that shortcoming. -if [ "$#" -eq 0 ] ; then +if [ "$#" -eq 0 ]; then readarray -t files < <(grep -l -r '^<<<<<<< HEAD' .) else files=("$@") @@ -33,8 +33,8 @@ SCRIPTDIR="$(cd "$(dirname "$0")" && pwd -P)" status=0 -for file in "${files[@]}" ; do - if ! "${SCRIPTDIR}"/resolve-conflicts.py --blank_lines "$file" ; then +for file in "${files[@]}"; do + if ! "${SCRIPTDIR}"/resolve-conflicts.py --blank_lines "$file"; then status=1 fi done diff --git a/resolve-import-conflicts b/resolve-import-conflicts index 635e3fe..e8f1806 100755 --- a/resolve-import-conflicts +++ b/resolve-import-conflicts @@ -24,7 +24,7 @@ echo "which is an obsolete version in https://github.com/plume-lib/git-scripts . # However, this can be run after a git mergetool that leaves conflict markers # in files, as the default git mergetool does. -if [ "$#" -eq 0 ] ; then +if [ "$#" -eq 0 ]; then readarray -t files < <(grep -l -r '^<<<<<<< HEAD' .) else files=("$@") @@ -34,8 +34,8 @@ SCRIPTDIR="$(cd "$(dirname "$0")" && pwd -P)" status=0 -for file in "${files[@]}" ; do - if ! "${SCRIPTDIR}"/resolve-conflicts.py --java_imports "$file" ; then +for file in "${files[@]}"; do + if ! "${SCRIPTDIR}"/resolve-conflicts.py --java_imports "$file"; then status=1 fi done From fb534548637fb4dfd0da09a4002241daa9df1d20 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sat, 10 May 2025 18:00:07 -0700 Subject: [PATCH 2/5] Fix target names --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 93f9f83..e5ed574 100644 --- a/Makefile +++ b/Makefile @@ -6,15 +6,15 @@ test: clean: ${MAKE} -C tests clean -check-style: check-python-style shell-script-style +check-style: python-style-check shell-style-check PYTHON_FILES=$(wildcard *.py) -python-style: +python-style-fix: ruff format ${PYTHON_FILES} ruff check ${PYTHON_FILES} --fix -check-python-style: +python-style-check: ruff format ${PYTHON_FILES} ruff check ${PYTHON_FILES} --fix From 93200d00f75c1cedb286d09da3726517a2413359 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sat, 10 May 2025 19:56:22 -0700 Subject: [PATCH 3/5] Debugging --- git-clone-related | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/git-clone-related b/git-clone-related index bf29669..3c2a411 100755 --- a/git-clone-related +++ b/git-clone-related @@ -49,6 +49,10 @@ if [ "$1" = "--debug" ]; then set -x fi +# Temporary +DEBUG=1 +set -x + # FALLBACK_BRANCH may be unset. if [ "$1" = "--upstream-branch" ]; then shift From bbe0321cf6f352d965698947658f58937a7fa257 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sat, 10 May 2025 20:01:45 -0700 Subject: [PATCH 4/5] Don't update Python --- .github/workflows/style.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index f99dc9e..e0678b1 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.13.3' + python-version: '3.11.5' - run: python --version - name: Install Python programs run: pip install ruff From 95e209ea7953fda6da49f1fda6a3d75d2be848cc Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sat, 10 May 2025 21:41:46 -0700 Subject: [PATCH 5/5] Undo a change --- git-clone-related | 4 ---- 1 file changed, 4 deletions(-) diff --git a/git-clone-related b/git-clone-related index 3c2a411..bf29669 100755 --- a/git-clone-related +++ b/git-clone-related @@ -49,10 +49,6 @@ if [ "$1" = "--debug" ]; then set -x fi -# Temporary -DEBUG=1 -set -x - # FALLBACK_BRANCH may be unset. if [ "$1" = "--upstream-branch" ]; then shift