From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id ENaGCzLpdWSRZgAASxT56A (envelope-from ) for ; Tue, 30 May 2023 14:16:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id SHR5CzLpdWRjMgAA9RJhRA (envelope-from ) for ; Tue, 30 May 2023 14:16:50 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E5E0B11726 for ; Tue, 30 May 2023 14:16:49 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3yGt-0005nQ-4K; Tue, 30 May 2023 08:16:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3yGg-0005eh-MQ for guix-patches@gnu.org; Tue, 30 May 2023 08:16:08 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q3yGg-0006Fx-EK for guix-patches@gnu.org; Tue, 30 May 2023 08:16:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q3yGg-0004zt-9k for guix-patches@gnu.org; Tue, 30 May 2023 08:16:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63802] [mumi PATCH 2/3] client: Add git-send-email-headers subcommand. Resent-From: Arun Isaac Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 30 May 2023 12:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63802 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63802@debbugs.gnu.org Cc: Arun Isaac , Maxim Cournoyer Received: via spool by 63802-submit@debbugs.gnu.org id=B63802.168544892419141 (code B ref 63802); Tue, 30 May 2023 12:16:02 +0000 Received: (at 63802) by debbugs.gnu.org; 30 May 2023 12:15:24 +0000 Received: from localhost ([127.0.0.1]:60368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q3yG4-0004yd-29 for submit@debbugs.gnu.org; Tue, 30 May 2023 08:15:24 -0400 Received: from mugam.systemreboot.net ([139.59.75.54]:37738) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q3yFz-0004y5-0e for 63802@debbugs.gnu.org; Tue, 30 May 2023 08:15:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=systemreboot.net; s=default; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=k4WIF/8ImVOTSX34H7i2lVUfFPW37agFqivrA/NI1RQ=; b=CSAruXzdrIwOfdgX0D2PiYhA9D YpS3h4qZ5I9bKGP4vBEtS+bt99RCTSi0+wUj0vf+Bqgd+jvcaA6xy012FRbZiy+mX7q78wQIGy+f6 29/TzPww9+mAJ9QFCXe4zdRau4lzS2u19XyNikQCPXtVAb0uI4sKb4LLu4LpfD2ona/v0N/SofFpM 15ZPbrBAHDOiZGx3tPA6y0Jo8wrgw4sNyty16iHaXsjhTjqiJ7440lHECyAUJQp3WJGqyY8KUIX3q /v/bgq1mX9QLPgKy5OMsQnkN5HwN0S1KdcC55gaMDUPJJvO/VNQdyoACif2ekZsjweqWI9dsTlb+0 QD3FTggQ==; Received: from [192.168.2.1] (port=38898 helo=localhost.localdomain) by systemreboot.net with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1q3yFu-001s3y-14; Tue, 30 May 2023 13:15:15 +0100 From: Arun Isaac Date: Tue, 30 May 2023 13:14:46 +0100 Message-Id: <20230530121447.26236-2-arunisaac@systemreboot.net> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230530121447.26236-1-arunisaac@systemreboot.net> References: <20230530121447.26236-1-arunisaac@systemreboot.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1685449009; a=rsa-sha256; cv=none; b=bDsdJOGrL7n0hxuMRUxbGpzP3BfirMlKAlF6zH2UGpSq8pWriAPW3PJYQr+QlEd8Cd84gi ERnu2R8OCWBM0YVVGRGvoWTUjQ9CWSX5jrmAqL0Y8Qb8DRyQLBATZ1jC/orGwL3D59GiTU FrJ4aO3IAQMSDqNXwVQ8JM+GjQtYBegzZ2IbHG9B4c6BPXpDiUGWP6zEh/85oK+JZ3yzGJ Wuorio7fAjtSyUTn19qfa19wDvZuX+apReDUx+/g3fMlX03Tmy/UDapalg62F85wuuXulk FF0yXdWk/83TXB7IFW8YmIbfp5aeIVo+xF3Bx9+Y8aAbZbUMBqO6eDX6OknauQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=systemreboot.net header.s=default header.b=CSAruXzd; dmarc=fail reason="SPF not aligned (relaxed)" header.from=systemreboot.net (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1685449009; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=k4WIF/8ImVOTSX34H7i2lVUfFPW37agFqivrA/NI1RQ=; b=BKBfyZRFQyHM/VW5Sc+/cccjgKvJuTKo5jo62YYp1NX9FqScv5J9tKfDRyHXh+VaxtYPWV OpG4m8D38iGaIF0Modc6GxOrWSXxE2QM5FexO98KNGg35u/0g2jdB2Ne2ZjPteEZV9Kydg lZ/EaU3mPTtj7A9zSVgzLwBpsQ9XT9RfDw911gVlao6BgxtUgWM7lZrRJ8q58yp81xWhyU VLHVqYk0qfTidrL28MsNLRo+eQyHtvVnzFWv8CPb6jlq3AZ5Xi5qHApvIYQcLmDQvnR8o3 ROBSmgxtp1aN8I9T8lfjsBY3HoQl7eujy5hS3La8fcmRzQI46qs2Vi3VRDR4gw== X-Migadu-Spam-Score: 1.89 X-Spam-Score: 1.89 X-Migadu-Queue-Id: E5E0B11726 X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=systemreboot.net header.s=default header.b=CSAruXzd; dmarc=fail reason="SPF not aligned (relaxed)" header.from=systemreboot.net (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-TUID: UnQf+EZoIaIV * mumi/client.scm: Import (rnrs exceptions). (git-send-email-headers): New public function. * scripts/mumi.in: Add git-send-email-headers subcommand. --- mumi/client.scm | 42 +++++++++++++++++++++++++++++++++++++++++- scripts/mumi.in | 2 ++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/mumi/client.scm b/mumi/client.scm index 5befd42..c70fe61 100644 --- a/mumi/client.scm +++ b/mumi/client.scm @@ -17,6 +17,7 @@ ;;; along with mumi. If not, see . (define-module (mumi client) + #:use-module (rnrs exceptions) #:use-module (rnrs io ports) #:use-module (srfi srfi-1) #:use-module (srfi srfi-19) @@ -38,7 +39,9 @@ print-current-issue set-current-issue! clear-current-issue! - send-email)) + send-email + git-send-email-headers + compose)) (define (git-top-level) "Return the top-level directory of the current git repository." @@ -306,3 +309,40 @@ ISSUE-NUMBER." "@" (client-config 'debbugs-host)) other-patches))))) + +(define (git-send-email-headers patch) + "Print send-email headers for PATCH." + (let* (;; Compute headers if configured in git config. + (header-command + (guard (ex (#t #f)) + (call-with-input-pipe* (list "git" "config" "sendemail.headerCmd") + get-line))) + (headers + (if header-command + (call-with-input-pipe (string-append header-command " " patch) + get-string-all) + "")) + (external-x-debbugs-cc + (assq-ref (parse-email-headers + (string-append (string-trim-right headers #\newline) + "\n")) + 'x-debbugs-cc)) + ;; Fetch Cc addresses for current issue. + (x-debbugs-cc + (assq-ref (reply-email-headers (current-issue-number)) + 'cc))) + ;; Print X-Debbugs-Cc header. + (when (or x-debbugs-cc external-x-debbugs-cc) + (display "X-Debbugs-Cc: ") + (display (if (and x-debbugs-cc external-x-debbugs-cc) + (string-append x-debbugs-cc ", " external-x-debbugs-cc) + (or x-debbugs-cc external-x-debbugs-cc))) + (newline)) + ;; Print headers other than X-Debbugs-Cc. + ;; TODO: RFC5322 headers are not restricted to a single + ;; line. "Folded" multi-line headers are allowed. Support them. + (for-each (lambda (line) + (unless (string-prefix-ci? "X-Debbugs-Cc:" line) + (display line) + (newline))) + (string-split headers #\newline)))) diff --git a/scripts/mumi.in b/scripts/mumi.in index 2295328..8fb7cd4 100644 --- a/scripts/mumi.in +++ b/scripts/mumi.in @@ -163,6 +163,8 @@ (client:clear-current-issue!)) (("send-email" . patches) (client:send-email patches)) + (("git-send-email-headers" patch) + (client:git-send-email-headers patch)) (("mailer" . rest) (let* ((opts (parse-options rest)) (sender (assoc-ref opts 'sender)) -- 2.39.2