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 <mackyle@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Kyle J. McKay committed
Mar 7, 2015 at 21:13 UTC
dcd01ea187fc9a936b4083a85343989840afd7bd
2 files changed
+17
-3
Documentation/git-imap-send.txt
+2
-1
@@ -44,7 +44,8 @@ OPTIONS
44
45
--no-curl::
46
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.
49
50
51
CONFIGURATION
imap-send.c
+15
-2
@@ -34,8 +34,16 @@ typedef void *SSL;
34
#include "http.h"
35
#endif
36
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
+
45
static int verbosity;
38
-static int use_curl; /* strictly opt in */
46
+static int use_curl = USE_CURL_DEFAULT;
47
48
static const char * const imap_send_usage[] = { "git imap-send [-v] [-q] [--[no-]curl] < <mbox>", NULL };
49
@@ -1504,9 +1512,14 @@ int main(int argc, char **argv)
1512
1513
#ifndef USE_CURL_FOR_IMAP_SEND
1514
if (use_curl) {
1507
- warning("--use-curl not supported in this build");
1515
+ warning("--curl not supported in this build");
1516
use_curl = 0;
1517
}
1518
+#elif defined(NO_OPENSSL)
1519
+ if (!use_curl) {
1520
+ warning("--no-curl not supported in this build");
1521
+ use_curl = 1;
1522
+ }
1523
#endif
1524
1525
if (!server.port)