git: 7d875598fc9f - main - git-arc: Make patch with reviewers more portable
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 25 Oct 2024 13:23:26 UTC
The branch main has been updated by 0mp:
URL: https://cgit.FreeBSD.org/src/commit/?id=7d875598fc9fdbe554644fc1109645362f21b824
commit 7d875598fc9fdbe554644fc1109645362f21b824
Author: Jose Luis Duran <jlduran@gmail.com>
AuthorDate: 2024-10-25 13:14:14 +0000
Commit: Mateusz Piotrowski <0mp@FreeBSD.org>
CommitDate: 2024-10-25 13:22:52 +0000
git-arc: Make patch with reviewers more portable
Avoid an ArcanistUsageException:
Provide method parameters on stdin as a JSON blob.
Due to an invalid JSON input on strict POSIX-compliant shells (macOS):
echo '{
"constraints": {"phids": [-n,"PHID-USER-xxx",]}
}' ^^^ ^
Change the non-portable "echo -n" to a printf.
Reviewed by: 0mp, imp, markj
Approved by: markj (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D46781
---
tools/tools/git/git-arc.sh | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/tools/git/git-arc.sh b/tools/tools/git/git-arc.sh
index e9398a60d2f7..3261f4461dc6 100644
--- a/tools/tools/git/git-arc.sh
+++ b/tools/tools/git/git-arc.sh
@@ -328,10 +328,10 @@ diff2reviewers()
jq '.response.data[0].attachments.reviewers.reviewers[] | select(.status == "accepted").reviewerPHID')
if [ -n "$userids" ]; then
echo '{
- "constraints": {"phids": ['"$(echo -n "$userids" | tr '[:space:]' ',')"']}
+ "constraints": {"phids": ['"$(printf "%s" "$userids" | tr '[:space:]' ',')"']}
}' |
- arc_call_conduit -- user.search |
- jq -r '.response.data[].fields.username'
+ arc_call_conduit -- user.search |
+ jq -r '.response.data[].fields.username'
fi
}
@@ -444,7 +444,7 @@ gitarc__list()
for commit in $commits; do
chash=$(git show -s --format='%C(auto)%h' "$commit")
- echo -n "${chash} "
+ printf "%s" "${chash} "
diff=$(log2diff "$commit")
if [ -n "$diff" ]; then
@@ -461,7 +461,7 @@ gitarc__list()
if [ -z "$diff" ]; then
echo "No Review : $title"
elif [ "$(echo "$diff" | wc -l)" -ne 1 ]; then
- echo -n "Ambiguous Reviews: "
+ printf "%s" "Ambiguous Reviews: "
echo "$diff" | grep -E -o 'D[1-9][0-9]*:' | tr -d ':' \
| paste -sd ',' - | sed 's/,/, /g'
else