Skip to content

Commit cd3269e

Browse files
committed
contrib: revert changes to github-merge.sh in #5038
1 parent ca067dc commit cd3269e

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

contrib/devtools/github-merge.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# name $BRANCH is overwritten with the merged result, and optionally pushed.
1414

1515
REPO="$(git config --get githubmerge.repository)"
16-
if [ "d$REPO" = "d" ]; then
16+
if [[ "d$REPO" == "d" ]]; then
1717
echo "ERROR: No repository configured. Use this command to set:" >&2
1818
echo "git config githubmerge.repository <owner>/<repo>" >&2
1919
echo "In addition, you can set the following variables:" >&2
@@ -24,25 +24,25 @@ if [ "d$REPO" = "d" ]; then
2424
fi
2525

2626
HOST="$(git config --get githubmerge.host)"
27-
if [ "d$HOST" = "d" ]; then
27+
if [[ "d$HOST" == "d" ]]; then
2828
2929
fi
3030

3131
BRANCH="$(git config --get githubmerge.branch)"
32-
if [ "d$BRANCH" = "d" ]; then
32+
if [[ "d$BRANCH" == "d" ]]; then
3333
BRANCH="master"
3434
fi
3535

3636
TESTCMD="$(git config --get githubmerge.testcmd)"
3737

3838
PULL="$1"
3939

40-
if [ "d$PULL" = "d" ]; then
40+
if [[ "d$PULL" == "d" ]]; then
4141
echo "Usage: $0 pullnumber [branch]" >&2
4242
exit 2
4343
fi
4444

45-
if [ "d$2" != "d" ]; then
45+
if [[ "d$2" != "d" ]]; then
4646
BRANCH="$2"
4747
fi
4848

@@ -101,7 +101,7 @@ else
101101
fi
102102

103103
# Run test command if configured.
104-
if [ "d$TESTCMD" != "d" ]; then
104+
if [[ "d$TESTCMD" != "d" ]]; then
105105
# Go up to the repository's root.
106106
while [ ! -d .git ]; do cd ..; done
107107
if ! $TESTCMD; then
@@ -112,10 +112,10 @@ if [ "d$TESTCMD" != "d" ]; then
112112
# Show the created merge.
113113
git diff pull/"$PULL"/merge..pull/"$PULL"/local-merge >"$TMPDIR"/diff
114114
git diff pull/"$PULL"/base..pull/"$PULL"/local-merge
115-
if [ "$(<"$TMPDIR"/diff)" != "" ]; then
115+
if [[ "$(<"$TMPDIR"/diff)" != "" ]]; then
116116
echo "WARNING: merge differs from github!" >&2
117117
read -p "Type 'ignore' to continue. " -r >&2
118-
if [ "d$REPLY" =~ ^d[iI][gG][nN][oO][rR][eE]$ ]; then
118+
if [[ "d$REPLY" =~ ^d[iI][gG][nN][oO][rR][eE]$ ]]; then
119119
echo "Difference with github ignored." >&2
120120
else
121121
cleanup
@@ -124,7 +124,7 @@ if [ "d$TESTCMD" != "d" ]; then
124124
fi
125125
read -p "Press 'd' to accept the diff. " -n 1 -r >&2
126126
echo
127-
if [ "d$REPLY" =~ ^d[dD]$ ]; then
127+
if [[ "d$REPLY" =~ ^d[dD]$ ]]; then
128128
echo "Diff accepted." >&2
129129
else
130130
echo "ERROR: Diff rejected." >&2
@@ -139,7 +139,7 @@ else
139139
bash -i
140140
read -p "Press 'm' to accept the merge. " -n 1 -r >&2
141141
echo
142-
if [ "d$REPLY" =~ ^d[Mm]$ ]; then
142+
if [[ "d$REPLY" =~ ^d[Mm]$ ]]; then
143143
echo "Merge accepted." >&2
144144
else
145145
echo "ERROR: Merge rejected." >&2
@@ -151,8 +151,8 @@ fi
151151
# Sign the merge commit.
152152
read -p "Press 's' to sign off on the merge. " -n 1 -r >&2
153153
echo
154-
if [ "d$REPLY" =~ ^d[Ss]$ ]; then
155-
if [ "$(git config --get user.signingkey)" = "" ]; then
154+
if [[ "d$REPLY" =~ ^d[Ss]$ ]]; then
155+
if [[ "$(git config --get user.signingkey)" == "" ]]; then
156156
echo "WARNING: No GPG signing key set, not signing. Set one using:" >&2
157157
echo "git config --global user.signingkey <key>" >&2
158158
git commit -q --signoff --amend --no-edit
@@ -168,6 +168,6 @@ cleanup
168168

169169
# Push the result.
170170
read -p "Type 'push' to push the result to $HOST:$REPO, branch $BRANCH. " -r >&2
171-
if [ "d$REPLY" =~ ^d[Pp][Uu][Ss][Hh]$ ]; then
171+
if [[ "d$REPLY" =~ ^d[Pp][Uu][Ss][Hh]$ ]]; then
172172
git push "$HOST":"$REPO" refs/heads/"$BRANCH"
173173
fi

0 commit comments

Comments
 (0)