Skip to content

Commit dcd01ea

Browse files
mackylegitster
authored andcommitted
imap-send: use cURL automatically when NO_OPENSSL defined
If both USE_CURL_FOR_IMAP_SEND and NO_OPENSSL are defined do not force the user to add --curl to get a working git imap-send command. Instead automatically select --curl and warn and ignore the --no-curl option. And while we're in there, correct the warning message when --curl is requested but not supported. Signed-off-by: Kyle J. McKay <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 230c09c commit dcd01ea

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

Documentation/git-imap-send.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ OPTIONS
4444

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

4950

5051
CONFIGURATION

imap-send.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,16 @@ typedef void *SSL;
3434
#include "http.h"
3535
#endif
3636

37+
#if defined(USE_CURL_FOR_IMAP_SEND) && defined(NO_OPENSSL)
38+
/* only available option */
39+
#define USE_CURL_DEFAULT 1
40+
#else
41+
/* strictly opt in */
42+
#define USE_CURL_DEFAULT 0
43+
#endif
44+
3745
static int verbosity;
38-
static int use_curl; /* strictly opt in */
46+
static int use_curl = USE_CURL_DEFAULT;
3947

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

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

15051513
#ifndef USE_CURL_FOR_IMAP_SEND
15061514
if (use_curl) {
1507-
warning("--use-curl not supported in this build");
1515+
warning("--curl not supported in this build");
15081516
use_curl = 0;
15091517
}
1518+
#elif defined(NO_OPENSSL)
1519+
if (!use_curl) {
1520+
warning("--no-curl not supported in this build");
1521+
use_curl = 1;
1522+
}
15101523
#endif
15111524

15121525
if (!server.port)

0 commit comments

Comments
 (0)