]> git.ipfire.org Git - thirdparty/git.git/commit - http.c
http: centralize the accounting of libcurl dependencies
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Mon, 13 Sep 2021 14:51:28 +0000 (16:51 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 13 Sep 2021 17:39:04 +0000 (10:39 -0700)
commite4ff3b67c2ad854113331029dea9843928a9c5ae
tree80578a881f8dd2a6f23a46c401adec989e2a252f
parent905a02880473c54f6c817e4ec8262d195d149940
http: centralize the accounting of libcurl dependencies

As discussed in 644de29e220 (http: drop support for curl < 7.19.4,
2021-07-30) checking against LIBCURL_VERSION_NUM isn't as reliable as
checking specific symbols present in curl, as some distros have been
known to backport features.

However, while some of the curl_easy_setopt() arguments we rely on are
macros, others are enum, and we can't assume that those that are
macros won't change into enums in the future.

So we're still going to have to check LIBCURL_VERSION_NUM, but by
doing that in one central place and using a macro definition of our
own, anyone who's backporting features can define it themselves, and
thus have access to more modern curl features that they backported,
even if they didn't bump the LIBCURL_VERSION_NUM.

More importantly, as shown in a preceding commit doing these version
checks makes for hard to read and possibly buggy code, as shown by the
bug fixed there where we were conflating base 10 for base 16 when
comparing the version.

By doing them all in one place we'll hopefully reduce the chances of
such future mistakes, furthermore it now becomes easier to see at a
glance what the oldest supported version is, which makes it easier to
reason about any future deprecation similar to the recent
e48a623dea0 (Merge branch 'ab/http-drop-old-curl', 2021-08-24).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-curl-compat.h [new file with mode: 0644]
http.c
imap-send.c