Search code examples
gitimap

Why does git-imap-send seem to be sending HTTP to an IMAP connection?


I hope that I'm not making some blatantly obvious mistake here, but when attempting to use git imap-send, in the command git format-patch --signoff --stdout --attach --root HEAD | git imap-send -v, I get this (error repeated once for each patch):

$ git format-patch --signoff --stdout --attach --root HEAD | git imap- 
send -v
sending 21 messages
*   Trying 192.168.1.22...
* Connected to mail.tdstoragebay.com (192.168.1.22) port 143 (#0)
* Server auth using Basic with user 'user'
> PUT /INBOX HTTP/1.1
Host: mail.tdstoragebay.com:143
Authorization: Basic auth-token
Accept: */*
Content-Length: 3233
Expect: 100-continue

* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE 
IDLE STARTTLS AUTH=PLAIN AUTH=LOGIN] TD-StorageBay Dovecot ready.
PUT BAD Error in IMAP command received by server.
Host: BAD Error in IMAP command received by server.
* BYE Too many invalid IMAP commands.
* Connection #0 to host mail.tdstoragebay.com left intact
* Found bundle for host mail.tdstoragebay.com: 0x1f59250 [serially]
* Connection 0 seems to be dead!
* Closing connection 0

It seems to me that git imap-send is attempting to send HTTP data to my IMAP server. All the documentation I've read seems says nothing about this behavior, and imap-send uses normal IMAP. If this is the case, what is going on, and more importantly, how can it be fixed?

Git version: 2.7.4

OS: Linux Mint 18.3

Git configuration:

imap.host=imap://mail.tdstoragebay.com (internal server)
imap.port=143
imap.folder=INBOX

Solution

  • There have been a few imap-send related fixes since Git 2.7.4

    Notably:

    • commit d2d07ab "imap-send: Tell cURL to use imap:// or imaps://" (Git 2.10.2)
    • commit 690307f "imap-send: add wrapper to get server credentials if needed " (Git 2.15.0)

    Any of those fixes could have an impact in your case.


    "git imap-send"(man) used to ignore configuration variables like core.askpass; this has been corrected with Git 2.30 (Q1 2021),

    See commit 5021236 (01 Dec 2020) by Nicolas Morey-Chaisemartin (nmorey).
    (Merged by Junio C Hamano -- gitster -- in commit 18da626, 08 Dec 2020)

    imap-send: parse default git config

    Reported-by: Philippe Blain
    Signed-off-by: Nicolas Morey-Chaisemartin

    git imap-send git config(man) does not parse the default settings and thus ignore core.askpass value.

    Rewrite config parsing to support core settings.