Skip to content

Commit

Permalink
Merge branch 'km/imap-send-libcurl-options' into maint
Browse files Browse the repository at this point in the history
"git imap-send" learned to optionally talk with an IMAP server via
libcURL; because there is no other option when Git is built with
NO_OPENSSL option, use that codepath by default under such
configuration.

* km/imap-send-libcurl-options:
  imap-send: use cURL automatically when NO_OPENSSL defined
  • Loading branch information
Junio C Hamano committed Mar 23, 2015
2 parents 82b6e33 + dcd01ea commit 84a37fa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Documentation/git-imap-send.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ OPTIONS

--no-curl::
Talk to the IMAP server using git's own IMAP routines instead of
using libcurl.
using libcurl. Ignored if Git was built with the NO_OPENSSL option
set.


CONFIGURATION
Expand Down
17 changes: 15 additions & 2 deletions imap-send.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,16 @@ typedef void *SSL;
#include "http.h"
#endif

#if defined(USE_CURL_FOR_IMAP_SEND) && defined(NO_OPENSSL)
/* only available option */
#define USE_CURL_DEFAULT 1
#else
/* strictly opt in */
#define USE_CURL_DEFAULT 0
#endif

static int verbosity;
static int use_curl; /* strictly opt in */
static int use_curl = USE_CURL_DEFAULT;

static const char * const imap_send_usage[] = { "git imap-send [-v] [-q] [--[no-]curl] < <mbox>", NULL };

Expand Down Expand Up @@ -1504,9 +1512,14 @@ int main(int argc, char **argv)

#ifndef USE_CURL_FOR_IMAP_SEND
if (use_curl) {
warning("--use-curl not supported in this build");
warning("--curl not supported in this build");
use_curl = 0;
}
#elif defined(NO_OPENSSL)
if (!use_curl) {
warning("--no-curl not supported in this build");
use_curl = 1;
}
#endif

if (!server.port)
Expand Down

0 comments on commit 84a37fa

Please sign in to comment.