Skip to content

Commit 7fec4e7

Browse files
committed
Merge #145: sync-upstream: fix quoting
95ee1fa sync-upstream: fix quoting (Jonas Nick) Pull request description: ACKs for top commit: real-or-random: ACK 95ee1fa Tree-SHA512: e730d5985cf3b02998d8cd07d3e007e3b5239745553a2b275f7442298f2602c154d3bdeb5904f81cc0da3ce2bd42cf09ba946afa9ab3215da2ff3c9ce2f63777
2 parents 9447642 + 95ee1fa commit 7fec4e7

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

contrib/sync-upstream.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,20 @@ git checkout master
100100
git pull
101101
git checkout -b temp-merge-"$PRNUM"
102102

103+
# Escape single quote
104+
# ' -> '\''
105+
quote() {
106+
local quoted=${1//\'/\'\\\'\'}
107+
printf "%s" "$quoted"
108+
}
109+
TITLE=$(quote "$TITLE")
110+
BODY=$(quote "$BODY")
111+
103112
BASEDIR=$(dirname "$0")
104113
FNAME="$BASEDIR/gh-pr-create.sh"
105114
cat <<EOT > "$FNAME"
106115
#!/bin/sh
107-
gh pr create -t "$TITLE" -b "$BODY" --web
116+
gh pr create -t '$TITLE' -b '$BODY' --web
108117
# Remove temporary branch
109118
git checkout master
110119
git branch -D temp-merge-"$PRNUM"

0 commit comments

Comments
 (0)