[bug#63802,3/3] client: Use mumi git-send-email-headers subcommand.
Commit Message
* mumi/client.scm (send-email): Accept mumi-command argument and use
it to construct --header-cmd.
* scripts/mumi.in: Pass command to send-email.
* tests/client.scm ("send patches to new issue", "send patches to
existing issue", "send single patch to new issue", "send single patch
to existing issue", "send patch to existing issue and Cc other
participants"): Adjust tests.
---
mumi/client.scm | 10 +++++++---
scripts/mumi.in | 2 +-
tests/client.scm | 17 ++++++++++++++---
3 files changed, 22 insertions(+), 7 deletions(-)
@@ -292,8 +292,9 @@ ISSUE-NUMBER."
(() (list))
(cc (list (cons 'cc (string-join cc ", "))))))))
-(define (send-email patches)
- "Send PATCHES via email."
+(define (send-email mumi-command patches)
+ "Send PATCHES via email. MUMI-COMMAND is the mumi program currently
+invoked."
(if (current-issue-number)
;; If an issue is current, send patches to that issue's email
;; address.
@@ -301,7 +302,10 @@ ISSUE-NUMBER."
(git-send-email (string-append (number->string issue-number)
"@"
(client-config 'debbugs-host))
- patches))
+ patches
+ (list (string-append "--header-cmd="
+ mumi-command
+ " git-send-email-headers"))))
(match patches
;; If it's a single patch, send it to the patch email address
;; and be done with it
@@ -162,7 +162,7 @@
(("new")
(client:clear-current-issue!))
(("send-email" . patches)
- (client:send-email patches))
+ (client:send-email (car (program-arguments)) patches))
(("git-send-email-headers" patch)
(client:git-send-email-headers patch))
(("mailer" . rest)
@@ -99,10 +99,13 @@ called with."
(const 12345))
client-config-stub)
(cut (@@ (mumi client) send-email)
+ "mumi"
(list "foo.patch" "bar.patch" "foobar.patch")))))))
(test-equal "send patches to existing issue"
- '(("git" "send-email" "--to=12345@example.com" "foo.patch" "bar.patch" "foobar.patch"))
+ '(("git" "send-email" "--to=12345@example.com"
+ "--header-cmd=mumi git-send-email-headers"
+ "foo.patch" "bar.patch" "foobar.patch"))
(map (match-lambda
((command _) command))
(trace-calls (var@@ (mumi client) call-with-input-pipe*)
@@ -114,6 +117,7 @@ called with."
client-config-stub
do-not-poll-server-for-issue-number)
(cut (@@ (mumi client) send-email)
+ "mumi"
(list "foo.patch" "bar.patch" "foobar.patch")))))))
(test-equal "send single patch to new issue"
@@ -127,10 +131,13 @@ called with."
client-config-stub
do-not-poll-server-for-issue-number)
(cut (@@ (mumi client) send-email)
+ "mumi"
(list "foo.patch")))))))
(test-equal "send single patch to existing issue"
- '(("git" "send-email" "--to=12345@example.com" "foo.patch"))
+ '(("git" "send-email" "--to=12345@example.com"
+ "--header-cmd=mumi git-send-email-headers"
+ "foo.patch"))
(map (match-lambda
((command _) command))
(trace-calls (var@@ (mumi client) call-with-input-pipe*)
@@ -142,10 +149,13 @@ called with."
client-config-stub
do-not-poll-server-for-issue-number)
(cut (@@ (mumi client) send-email)
+ "mumi"
(list "foo.patch")))))))
(test-equal "send patch to existing issue and Cc other participants"
- '(("git" "send-email" "--to=12345@example.com" "foo.patch"))
+ '(("git" "send-email" "--to=12345@example.com"
+ "--header-cmd=mumi git-send-email-headers"
+ "foo.patch"))
(map (match-lambda
((command _) command))
(trace-calls (var@@ (mumi client) call-with-input-pipe*)
@@ -157,6 +167,7 @@ called with."
client-config-stub
do-not-poll-server-for-issue-number)
(cut (@@ (mumi client) send-email)
+ "mumi"
(list "foo.patch")))))))
(test-end "client")