Merge branch 'jk/send-email-complete-aliases'
Teach send-email to dump mail aliases, so that we can do tab completion on the command line. * jk/send-email-complete-aliases: completion: add support for completing email aliases sendemail: teach git-send-email to dump alias names
This commit is contained in:
@ -1555,6 +1555,88 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' '
|
||||
grep "^!someone@example\.org!$" commandline1
|
||||
'
|
||||
|
||||
test_dump_aliases () {
|
||||
msg="$1" && shift &&
|
||||
filetype="$1" && shift &&
|
||||
printf '%s\n' "$@" >expect &&
|
||||
cat >.tmp-email-aliases &&
|
||||
|
||||
test_expect_success $PREREQ "$msg" '
|
||||
clean_fake_sendmail && rm -fr outdir &&
|
||||
git config --replace-all sendemail.aliasesfile \
|
||||
"$(pwd)/.tmp-email-aliases" &&
|
||||
git config sendemail.aliasfiletype "$filetype" &&
|
||||
git send-email --dump-aliases 2>errors >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
}
|
||||
|
||||
test_dump_aliases '--dump-aliases sendmail format' \
|
||||
'sendmail' \
|
||||
'abgroup' \
|
||||
'alice' \
|
||||
'bcgrp' \
|
||||
'bob' \
|
||||
'chloe' <<-\EOF
|
||||
alice: Alice W Land <awol@example.com>
|
||||
bob: Robert Bobbyton <bob@example.com>
|
||||
chloe: chloe@example.com
|
||||
abgroup: alice, bob
|
||||
bcgrp: bob, chloe, Other <o@example.com>
|
||||
EOF
|
||||
|
||||
test_dump_aliases '--dump-aliases mutt format' \
|
||||
'mutt' \
|
||||
'alice' \
|
||||
'bob' \
|
||||
'chloe' \
|
||||
'donald' <<-\EOF
|
||||
alias alice Alice W Land <awol@example.com>
|
||||
alias donald Donald C Carlton <donc@example.com>
|
||||
alias bob Robert Bobbyton <bob@example.com>
|
||||
alias chloe chloe@example.com
|
||||
EOF
|
||||
|
||||
test_dump_aliases '--dump-aliases mailrc format' \
|
||||
'mailrc' \
|
||||
'alice' \
|
||||
'bob' \
|
||||
'chloe' \
|
||||
'eve' <<-\EOF
|
||||
alias alice Alice W Land <awol@example.com>
|
||||
alias eve Eve <eve@example.com>
|
||||
alias bob Robert Bobbyton <bob@example.com>
|
||||
alias chloe chloe@example.com
|
||||
EOF
|
||||
|
||||
test_dump_aliases '--dump-aliases pine format' \
|
||||
'pine' \
|
||||
'alice' \
|
||||
'bob' \
|
||||
'chloe' \
|
||||
'eve' <<-\EOF
|
||||
alice Alice W Land <awol@example.com>
|
||||
eve Eve <eve@example.com>
|
||||
bob Robert Bobbyton <bob@example.com>
|
||||
chloe chloe@example.com
|
||||
EOF
|
||||
|
||||
test_dump_aliases '--dump-aliases gnus format' \
|
||||
'gnus' \
|
||||
'alice' \
|
||||
'bob' \
|
||||
'chloe' \
|
||||
'eve' <<-\EOF
|
||||
(define-mail-alias "alice" "awol@example.com")
|
||||
(define-mail-alias "eve" "eve@example.com")
|
||||
(define-mail-alias "bob" "bob@example.com")
|
||||
(define-mail-alias "chloe" "chloe@example.com")
|
||||
EOF
|
||||
|
||||
test_expect_success '--dump-aliases must be used alone' '
|
||||
test_must_fail git send-email --dump-aliases --to=janice@example.com -1 refs/heads/accounting
|
||||
'
|
||||
|
||||
test_sendmail_aliases () {
|
||||
msg="$1" && shift &&
|
||||
expect="$@" &&
|
||||
|
Reference in New Issue
Block a user