Skip to content

Commit 079eebb

Browse files
committed
Merge branch 'ab/imap-send-requires-curl' into seen
* ab/imap-send-requires-curl: imap-send: replace auto-probe libcurl with hard dependency
2 parents d1e775e + b16aedd commit 079eebb

File tree

4 files changed

+14
-58
lines changed

4 files changed

+14
-58
lines changed

Documentation/git-imap-send.txt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,6 @@ OPTIONS
3737
--quiet::
3838
Be quiet.
3939

40-
--curl::
41-
Use libcurl to communicate with the IMAP server, unless tunneling
42-
into it. Ignored if Git was built without the USE_CURL_FOR_IMAP_SEND
43-
option set.
44-
45-
--no-curl::
46-
Talk to the IMAP server using git's own IMAP routines instead of
47-
using libcurl. Ignored if Git was built with the NO_OPENSSL option
48-
set.
49-
5040

5141
CONFIGURATION
5242
-------------

INSTALL

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ Issues of note:
129129
itself, e.g. Digest::MD5, File::Spec, File::Temp, Net::Domain,
130130
Net::SMTP, and Time::HiRes.
131131

132-
- git-imap-send needs the OpenSSL library to talk IMAP over SSL if
133-
you are using libcurl older than 7.34.0. Otherwise you can use
134-
NO_OPENSSL without losing git-imap-send.
132+
- git-imap-send needs libcurl 7.34.0 or newer, in addition
133+
OpenSSL is needed if using the "imap.tunnel" open to tunnel
134+
over SSL. Define NO_OPENSSL to omit the OpenSSL prerequisite.
135135

136136
- "libcurl" library is used for fetching and pushing
137137
repositories over http:// or https://, as well as by
138-
git-imap-send if the curl version is >= 7.34.0. If you do
138+
git-imap-send. If you do
139139
not need that functionality, use NO_CURL to build without
140140
it.
141141

Makefile

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,9 @@ PROGRAMS += $(EXTRA_PROGRAMS)
773773

774774
PROGRAM_OBJS += daemon.o
775775
PROGRAM_OBJS += http-backend.o
776+
ifndef NO_CURL
776777
PROGRAM_OBJS += imap-send.o
778+
endif
777779
PROGRAM_OBJS += sh-i18n--envsubst.o
778780
PROGRAM_OBJS += shell.o
779781
.PHONY: program-objs
@@ -1583,7 +1585,6 @@ ifdef HAVE_ALLOCA_H
15831585
BASIC_CFLAGS += -DHAVE_ALLOCA_H
15841586
endif
15851587

1586-
IMAP_SEND_BUILDDEPS =
15871588
IMAP_SEND_LDFLAGS =
15881589

15891590
ifdef NO_CURL
@@ -1592,6 +1593,7 @@ ifdef NO_CURL
15921593
REMOTE_CURL_ALIASES =
15931594
REMOTE_CURL_NAMES =
15941595
EXCLUDED_PROGRAMS += git-http-fetch git-http-push
1596+
EXCLUDED_PROGRAMS += git-imap-send
15951597
else
15961598
ifdef CURLDIR
15971599
# Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
@@ -1617,19 +1619,9 @@ else
16171619
REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
16181620
PROGRAM_OBJS += http-fetch.o
16191621
PROGRAMS += $(REMOTE_CURL_NAMES)
1622+
IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
16201623
ifndef NO_EXPAT
16211624
PROGRAM_OBJS += http-push.o
1622-
endif
1623-
curl_check := $(shell (echo 072200; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
1624-
ifeq "$(curl_check)" "072200"
1625-
USE_CURL_FOR_IMAP_SEND = YesPlease
1626-
endif
1627-
ifdef USE_CURL_FOR_IMAP_SEND
1628-
BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
1629-
IMAP_SEND_BUILDDEPS = http.o
1630-
IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
1631-
endif
1632-
ifndef NO_EXPAT
16331625
ifdef EXPATDIR
16341626
BASIC_CFLAGS += -I$(EXPATDIR)/include
16351627
EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
@@ -2786,7 +2778,7 @@ endif
27862778
git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
27872779
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
27882780

2789-
git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
2781+
git-imap-send$X: imap-send.o http.o GIT-LDFLAGS $(GITLIBS)
27902782
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
27912783
$(IMAP_SEND_LDFLAGS) $(LIBS)
27922784

imap-send.c

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,16 @@
3030
#if defined(NO_OPENSSL) && !defined(HAVE_OPENSSL_CSPRNG)
3131
typedef void *SSL;
3232
#endif
33-
#ifdef USE_CURL_FOR_IMAP_SEND
3433
#include "http.h"
35-
#endif
36-
37-
#if defined(USE_CURL_FOR_IMAP_SEND)
38-
/* Always default to curl if it's available. */
39-
#define USE_CURL_DEFAULT 1
40-
#else
41-
/* We don't have curl, so continue to use the historical implementation */
42-
#define USE_CURL_DEFAULT 0
43-
#endif
4434

4535
static int verbosity;
46-
static int use_curl = USE_CURL_DEFAULT;
36+
static int use_curl = 1;
4737

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

5040
static struct option imap_send_options[] = {
5141
OPT__VERBOSITY(&verbosity),
52-
OPT_BOOL(0, "curl", &use_curl, "use libcurl to communicate with the IMAP server"),
42+
OPT_HIDDEN_BOOL(0, "curl", &use_curl, "use libcurl to communicate with the IMAP server"),
5343
OPT_END()
5444
};
5545

@@ -1396,7 +1386,6 @@ static int append_msgs_to_imap(struct imap_server_conf *server,
13961386
return 0;
13971387
}
13981388

1399-
#ifdef USE_CURL_FOR_IMAP_SEND
14001389
static CURL *setup_curl(struct imap_server_conf *srvc, struct credential *cred)
14011390
{
14021391
CURL *curl;
@@ -1515,7 +1504,6 @@ static int curl_append_msgs_to_imap(struct imap_server_conf *server,
15151504

15161505
return res != CURLE_OK;
15171506
}
1518-
#endif
15191507

15201508
int cmd_main(int argc, const char **argv)
15211509
{
@@ -1531,17 +1519,8 @@ int cmd_main(int argc, const char **argv)
15311519
if (argc)
15321520
usage_with_options(imap_send_usage, imap_send_options);
15331521

1534-
#ifndef USE_CURL_FOR_IMAP_SEND
1535-
if (use_curl) {
1536-
warning("--curl not supported in this build");
1537-
use_curl = 0;
1538-
}
1539-
#elif defined(NO_OPENSSL)
1540-
if (!use_curl) {
1541-
warning("--no-curl not supported in this build");
1542-
use_curl = 1;
1543-
}
1544-
#endif
1522+
if (!use_curl)
1523+
die(_("the --no-curl option to imap-send has been deprecated"));
15451524

15461525
if (!server.port)
15471526
server.port = server.use_ssl ? 993 : 143;
@@ -1580,10 +1559,5 @@ int cmd_main(int argc, const char **argv)
15801559
if (server.tunnel)
15811560
return append_msgs_to_imap(&server, &all_msgs, total);
15821561

1583-
#ifdef USE_CURL_FOR_IMAP_SEND
1584-
if (use_curl)
1585-
return curl_append_msgs_to_imap(&server, &all_msgs, total);
1586-
#endif
1587-
1588-
return append_msgs_to_imap(&server, &all_msgs, total);
1562+
return curl_append_msgs_to_imap(&server, &all_msgs, total);
15891563
}

0 commit comments

Comments
 (0)