git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Dan AlbertNext: Dan Albert
Message 2 of 8 in “Uses git-credential for git-imap-send”
  1. Uses git-credential for git-imap-sendDan Albert, Apr 26, 2014
  2. Jeff KingApr 26, 2014
  3. Uses git-credential for git-imap-sendDan Albert, Apr 27, 2014
  4. Jeff KingApr 28, 2014
  5. Uses git-credential for git-imap-sendDan Albert, Apr 29, 2014
  6. Jeff KingApr 29, 2014
  7. Junio C HamanoApr 29, 2014
  8. Jeff KingApr 27, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.