The branch master has been updated via bb40e3e6bcd68b3ba9ba4e71751d9f8e630f63cf (commit) via f2effd8b3868d3aff563d3a3c31c873598a08e2b (commit) via c74b36e1cb2dec9183928b00a065131909c9412e (commit) from 9c2a1bcbb06f1075307267fe16bd34e43f750cd4 (commit)
- Log ----------------------------------------------------------------- commit bb40e3e6bcd68b3ba9ba4e71751d9f8e630f63cf Author: Dr. Matthias St. Pierre <matthias.st.pie...@ncp-e.com> Date: Fri Jan 26 15:32:35 2018 +0100 add missing quotes to fix runtime error [fixup] commit f2effd8b3868d3aff563d3a3c31c873598a08e2b Author: Dr. Matthias St. Pierre <matthias.st.pie...@ncp-e.com> Date: Fri Jan 26 12:08:48 2018 +0100 correct whitespace errors [fixup] commit c74b36e1cb2dec9183928b00a065131909c9412e Author: Dr. Matthias St. Pierre <matthias.st.pie...@ncp-e.com> Date: Fri Jan 26 10:33:22 2018 +0100 ghmerge: improve error handling When python3 is the default python interpreter, the embedded script fails with a syntax error at the print statement. In the absence of error checking, this leads to a cascade of unhandled errors, ending up in an empty pager window. Here an example: ghmerge prnum reviewer1 reviewer2 - the empty output of the python command causes the env command to print the (named and positional) parameters instead of clearing $1 and $2. Consequently, the script assigns WHO=reviewer1 and BRANCH=reviewer2. - git checks out a local branch reviewer1-reviewer2 and tries to pull from https://github.com/reviewer1/openssl.git reviewer2 This call fails, and again the error is ignored. - The call `git diff reviewer1-reviewer2` leads to the empty pager window, since git has no diffs to show. Countermeasures - make the python script work for python2 and python3 - add a break-on-error statement (`set -o errexit`, aka `set -e`) - replace `set` by `set --` which changes the behaviour of the set command as desired (see `man set`). - add an explicit check for $WHO and $BRANCH - add an exit trap for cleaning up the branch Signed-off-by: Dr. Matthias St. Pierre <matthias.st.pie...@ncp-e.com> ----------------------------------------------------------------------- Summary of changes: review-tools/ghmerge | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/review-tools/ghmerge b/review-tools/ghmerge index 401d80c..b1aebb9 100755 --- a/review-tools/ghmerge +++ b/review-tools/ghmerge @@ -1,5 +1,7 @@ #! /bin/bash +set -o errexit + if [ ! -d .git ] ; then echo Not at top-level exit 1 @@ -31,17 +33,34 @@ esac curl -s https://api.github.com/repos/openssl/openssl/pulls/$PRNUM >/tmp/gh$$ TEAM=$* -set `python -c ' +set -- `python -c ' +from __future__ import print_function import json, sys; -print str(json.load(sys.stdin)["head"]["label"]).replace(":", " ")' </tmp/gh$$` +print(str(json.load(sys.stdin)["head"]["label"]).replace(":", " "))' </tmp/gh$$` rm /tmp/gh$$ WHO=$1 BRANCH=$2 -REL=`git branch | fgrep '*' | tr -d '* '` +if [ -z "$WHO" -o -z "$BRANCH" ]; then + echo "Don't know from which branch to fetch" + exit 1 +fi + +REL=`git rev-parse --abbrev-ref HEAD` WORK="${WHO}-${BRANCH}" +PREV= git checkout -b $WORK $REL + +function cleanup { + if [ "$WORK" != "$REL" ]; then + git checkout -q $REL + git branch -D $WORK + fi +} +trap 'cleanup' EXIT + + git pull --rebase https://github.com/$WHO/openssl.git $BRANCH git rebase $REL echo Diff against $REL @@ -52,7 +71,7 @@ addrev $TRIVIAL --prnum=$PRNUM $TEAM ${REL}.. git checkout $REL if [ "$MERGE" == "yes" ] ; then git merge --no-commit --squash $WORK - AUTHOR=`git show --no-patch --pretty=format:%an <%ae> $WORK` + AUTHOR=`git show --no-patch --pretty="format:%an <%ae>" $WORK` git commit --author="$AUTHOR" else git rebase $WORK @@ -72,5 +91,3 @@ done if [ "$x" = "y" -o "$x" = "yes" ] ; then git push origin $REL fi - -git branch -D $WORK _____ openssl-commits mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-commits