The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3d4a61a10bb7a921cee7a06696034e36fb221b95
commit 3d4a61a10bb7a921cee7a06696034e36fb221b95 Author: Mark Johnston <ma...@freebsd.org> AuthorDate: 2025-07-02 13:42:42 +0000 Commit: Mark Johnston <ma...@freebsd.org> CommitDate: 2025-07-02 13:42:42 +0000 git-arc: Try harder to get the author name and email out of phab When patching, we use the querydiffs endpoint to get a name and email for the revision's author. It's possible that this info isn't recorded, in which case the results after post-processing are just "null". However, if the diff has multiple revisions, the endpoint returns an entry for each one, some of which may contain author info, others not. So, the deleted code which tries to filter out "null" isn't sufficient, since the value in question might be something like "<valid name>\nnull". Try to make this filtering a bit smarter to avoid generating incorrect author info. Reviewed by: jlduran Reported by: des MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D51065 --- tools/tools/git/git-arc.sh | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tools/tools/git/git-arc.sh b/tools/tools/git/git-arc.sh index b49721159799..d953a30cb90d 100644 --- a/tools/tools/git/git-arc.sh +++ b/tools/tools/git/git-arc.sh @@ -582,17 +582,10 @@ patch_commit() echo '{"revisionIDs": [ '"${diff#D}"' ]}' | \ arc_call_conduit -- differential.querydiffs | jq -r '.response | flatten | .[]' > "$diff_data" - author_addr=$(jq -r ".authorEmail?" "$diff_data" | sort -u) - author_name=$(jq -r ".authorName?" "$diff_data" | sort -u) - - # JSON will return "null" when a field is not populated. - # Turn this string into an empty one. - if [ "$author_addr" = "null" ]; then - author_addr="" - fi - if [ "$author_name" = "null" ]; then - author_name="" - fi + # If the differential revision has multiple revisions, just take the first + # non-null value we get. + author_addr=$(jq -r ".authorEmail?" "$diff_data" | grep -v '^null$' | head -n 1) + author_name=$(jq -r ".authorName?" "$diff_data" | grep -v '^null$' | head -n 1) author=$(find_author "$user_addr" "$user_name" "$author_addr" "$author_name")