git: d6ed5ff4ac7d - main - git-arc: fix diff2reviewers() with multiple reviewers

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Wed, 04 Dec 2024 02:39:36 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=d6ed5ff4ac7d9610385b35f77539ccf5bae8cc65

commit d6ed5ff4ac7d9610385b35f77539ccf5bae8cc65
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2024-12-04 02:38:41 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2024-12-04 02:38:41 +0000

    git-arc: fix diff2reviewers() with multiple reviewers
    
    The select command of jq provides us with a multiline output.  Thus, the
    ${userids} is a newline separated list.  The recent change 9e84289f2c7e
    explicitly said that we aren't going to translate newline to comma when
    constructing JSON for the next command.  It also forces the ${userids} to
    be printed as is, with shell's field splitting disabled.  So we end up
    with invalid JSON, that is missing commas.
    
    Fix this by enabling shell's field splitting by printing ${userids}
    outside of double quotes.
    
    Reviewed by:            jlduran, imp, emaste
    Differential Revision:  https://reviews.freebsd.org/D47889
    Fixes:                  9e84289f2c7e6b632047a75b653fcd587287a8b9
---
 tools/tools/git/git-arc.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/tools/git/git-arc.sh b/tools/tools/git/git-arc.sh
index 6ef1abf4e0c6..b49721159799 100644
--- a/tools/tools/git/git-arc.sh
+++ b/tools/tools/git/git-arc.sh
@@ -341,7 +341,7 @@ diff2reviewers()
         jq '.response.data[0].attachments.reviewers.reviewers[] | select(.status == "accepted").reviewerPHID')
     if [ -n "$userids" ]; then
         echo '{
-        "constraints": {"phids": ['"$(echo "$userids" | tr '[:blank:]' ',')"']}
+        "constraints": {"phids": ['"$(echo $userids | tr '[:blank:]' ',')"']}
         }' |
         arc_call_conduit -- user.search |
         jq -r '.response.data[].fields.username'