Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync-upstream: fix "end" parameter for specifying range #135

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions contrib/sync-upstream.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ if [ "$#" -lt 1 ]; then
fi

REMOTE=upstream
REMOTE_BRANCH=$REMOTE/master
REMOTE_BRANCH="$REMOTE/master"
# Makes sure you have a remote "upstream" that is up-to-date
setup() {
ret=0
git fetch $REMOTE &> /dev/null || ret=$?
git fetch "$REMOTE" &> /dev/null || ret="$?"
if [ ${ret} == 0 ]; then
return
fi
Expand All @@ -36,18 +36,18 @@ setup() {
[Yy]* ) ;;
* ) exit 1;;
esac
git remote add $REMOTE git@github.com:bitcoin-core/secp256k1.git &> /dev/null
git fetch $REMOTE &> /dev/null
git remote add "$REMOTE" git@github.com:bitcoin-core/secp256k1.git &> /dev/null
git fetch "$REMOTE" &> /dev/null
}

range() {
RANGESTART_COMMIT=$(git merge-base $REMOTE_BRANCH master)
RANGEEND_COMMIT=$(git rev-parse $REMOTE_BRANCH)
RANGESTART_COMMIT=$(git merge-base "$REMOTE_BRANCH" master)
RANGEEND_COMMIT=$(git rev-parse "$REMOTE_BRANCH")
if [ "$#" = 1 ]; then
RANGEEND_COMMIT=$1
fi

COMMITS=$(git --no-pager log --oneline "$REMOTE_BRANCH" --merges "$RANGESTART_COMMIT".."$RANGEEND_COMMIT")
COMMITS=$(git --no-pager log --oneline --merges "$RANGESTART_COMMIT".."$RANGEEND_COMMIT")
COMMITS=$(echo "$COMMITS" | tac | awk '{ print $1 }' ORS=' ')
echo "Merging $COMMITS. Continue with y"
read -r yn
Expand Down Expand Up @@ -101,7 +101,7 @@ git pull
git checkout -b temp-merge-"$PRNUM"

BASEDIR=$(dirname "$0")
FNAME=$BASEDIR/gh-pr-create.sh
FNAME="$BASEDIR/gh-pr-create.sh"
cat <<EOT > "$FNAME"
#!/bin/sh
gh pr create -t "$TITLE" -b "$BODY" --web
Expand Down