stgit
stgit copied to clipboard
RFE: e-mail alias lookup should occur before editing the cover letter
[cel@bazille linux]$ stg mail -e --to=nfs --to=fsdevel [email protected] clean-up-nfsd3-proc-create..instantiate-a-struct-file-when
Checking the validity of the patches ... done
Invoking the editor: "/usr/bin/vim .stgitmail.txt" ... done
stg mail: unknown e-mail alias: fsdevel
[cel@bazille linux]$
Second time in two days I've spent time perfecting a cover letter, only to be told after leaving the editor that I made a mistake on the command line. The "stg mail" command fails and the cover letter contents are nowhere to be found.
Thank you for writing up this issue. As always, I appreciate your feedback on StGit, @chucklever. Losing a cover letter this way sounds frustrating.
Speaking of which, please refer to #185 and #186. I'd really like your feedback on how to address stg mail
for StGit 2.0.
For StGit 2.0, stg email send
is a wrapper for git send-email
. As such, the behavior of email alias resolution is what git send-email
does. Specifically, git send-email
seems to resolve the aliases it knows about, but pass-through any other addresses to the "To:" field without further checking or warning. This would ostensibly be so that the user's MTA and/or the MDA could do their own alias mapping.
So the behavior of stg email send
does not do what this issue asks for.
That said, for safe cover letter editing, a workflow using stg email format --cover-letter
then stg email send
would avoid the main pathology of losing work in the case of incorrect email aliases. I.e. this workflow:
$ stg email format --cover-letter -o out-dir patch0..patchN
$ ${EDITOR} out-dir/0000-cover-letter.patch
$ stg email send --to=alias1 --to=alias2 out-dir
is safer than trying to send with a cover letter in a single-shot (similar to the old stg mail
command) with:
$ stg email send --to=alias1 --to=alias2 --compose patch0..patchN
We could conceivably modify stg email send
to first gather the list of known aliases using git send-email --dump-aliases
and then check all "To" and "Cc" addresses to ensure they either match a known alias or look like an email address. However, I'm not inclined to take this approach given its strategic difference from git send-email
and that it would not allow for alias resolution to occur further down the email pipeline.