Re: [PATCH] Uses git-credential for git-imap-send
- From
Jeff King <peff@peff.net>
- Date
- Apr 26, 2014, 18:08 UTC
- Message-ID
- <20140426180835.GE21493@sigill.intra.peff.net>
- In-Reply-To
- <CAFVaGhudmcrh32_h3RPmR_E7e3Jo9xc6AEt5AtN2W5NVbEMg6w@mail.gmail.com>
On Sat, Apr 26, 2014 at 10:50:26AM -0700, Dan Albert wrote:
> git-imap-send was directly prompting for a password rather than using > git-credential. git-send-email, on the other hand, supports > git-credential.
Yay. These sorts of conversions were definitely on my mind when I did the original credential work, and have mostly been waiting on somebody who cares enough about specific tools to switch them over.
> static struct imap_store *imap_open_store(struct imap_server_conf *srvc)
> {
> + struct credential cred = CREDENTIAL_INIT;Your patch seems to have been whitespace-damaged in transit (there are hints for gmail in the format-patch and send-email manpages).
Show 5 quoted lines
> + cred.username = xstrdup(srvc->user);
> + cred.protocol = xstrdup("imap");
> + cred.host = xstrdup(srvc->host);
> + credential_fill(&cred);
> + srvc->pass = xstrdup(cred.password);The "imap" protocol will get passed along to any helpers. I think the only one which actually cares about the specific content is the osxkeychain helper, which differentiates between "imap" and "imaps". I think we can know which is which at this point and do:
cred.protocol = xstrdup(srvc->use_ssl ? "imaps" : "imap");
Other than that, the patch looks good. Tests would be wonderful, but we have no infrastructure at all, so it would involve writing a mock IMAP server. Having implemented both IMAP servers and clients in a previous life, I could not ask anyone to go through that pain. :)
-Peff