From 1b9d9e6cb0ff5b566599a2479d19f16adeb48d6d Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Mon, 28 Apr 2014 18:29:05 +0200 Subject: [PATCH 1/6] Makefile: do not depend on curl-config MinGW builds of cURL does not ship with curl-config unless built with the autoconf based build system, which is not the practice recommended by the documentation. MsysGit has had issues with binaries of that sort, so it has switched away from autoconf-based cURL-builds. Unfortunately, broke pushing over WebDAV on Windows, because http-push.c depends on cURL's multi-threaded API, which we could not determine the presence of any more. Since troublesome curl-versions are ancient, and not even present in RedHat 5, let's just assume cURL is capable instead of doing a non-robust check. Instead, add a check for curl_multi_init to our configure-script, for those on ancient system. They probably already need to do the configure-dance anyway. Signed-off-by: Erik Faye-Lund --- Makefile | 7 ++----- configure.ac | 11 +++++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 20058f1de7..4edaaac6d4 100644 --- a/Makefile +++ b/Makefile @@ -1035,14 +1035,11 @@ else REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES) PROGRAM_OBJS += http-fetch.o PROGRAMS += $(REMOTE_CURL_NAMES) - curl_check := $(shell (echo 070908; curl-config --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p) - ifeq "$(curl_check)" "070908" + ifndef NO_CURL_MULTI ifndef NO_EXPAT PROGRAM_OBJS += http-push.o endif - endif - curl_check := $(shell (echo 072200; curl-config --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p) - ifeq "$(curl_check)" "072200" + # Assume that cURL is new enough USE_CURL_FOR_IMAP_SEND = YesPlease endif ifdef USE_CURL_FOR_IMAP_SEND diff --git a/configure.ac b/configure.ac index 55e5a9b3e6..f98b1e20e3 100644 --- a/configure.ac +++ b/configure.ac @@ -521,6 +521,17 @@ AC_CHECK_LIB([curl], [curl_global_init], [NO_CURL=], [NO_CURL=YesPlease]) +if test -z "$NO_CURL"; then + +AC_CHECK_DECLS([curl_multi_init], +[NO_CURL_MULTI=], +[NO_CURL_MULTI=UnfortunatelyYes], +[[#include ]]) + +GIT_CONF_SUBST([NO_CURL_MULTI]) + +fi + GIT_UNSTASH_FLAGS($CURLDIR) GIT_CONF_SUBST([NO_CURL]) From 0ca2947f6b92f8373838cb1e1c13416456387cc4 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 24 Feb 2015 13:07:10 -0600 Subject: [PATCH 2/6] Only use CURLOPT_LOGIN_OPTIONS if it is actually available This fixes the compilation on an older Linux that was used to debug test failures when upgrading Git for Windows to Git v2.3.0. Signed-off-by: Johannes Schindelin --- imap-send.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/imap-send.c b/imap-send.c index 37ac4aa86a..8c3fc212ba 100644 --- a/imap-send.c +++ b/imap-send.c @@ -1422,11 +1422,15 @@ static CURL *setup_curl(struct imap_server_conf *srvc) curl_easy_setopt(curl, CURLOPT_PORT, server.port); if (server.auth_method) { +#if LIBCURL_VERSION_NUM < 0x072200 + warning("No LOGIN_OPTIONS support in this cURL version"); +#else struct strbuf auth = STRBUF_INIT; strbuf_addstr(&auth, "AUTH="); strbuf_addstr(&auth, server.auth_method); curl_easy_setopt(curl, CURLOPT_LOGIN_OPTIONS, auth.buf); strbuf_release(&auth); +#endif } if (!server.use_ssl) From 67d0d2facfaf2bc71bc817dbc97ab4ec650770a8 Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Sat, 28 Feb 2015 23:59:04 +0100 Subject: [PATCH 3/6] remote-http(s): Support SOCKS proxies With this patch we properly support SOCKS proxies, configured e.g. like this: git config http.proxy socks5://192.168.67.1:32767 Without this patch, Git mistakenly tries to use SOCKS proxies as if they were HTTP proxies, resulting in a error message like: fatal: unable to access 'http://.../': Proxy CONNECT aborted This patch was required to work behind a faulty AP and scraped from http://stackoverflow.com/questions/15227130/#15228479 and guarded with an appropriate cURL version check by Johannes Schindelin. Signed-off-by: Johannes Schindelin --- http.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/http.c b/http.c index 6798620065..891e6dae89 100644 --- a/http.c +++ b/http.c @@ -373,6 +373,17 @@ static CURL *get_curl_handle(void) if (curl_http_proxy) { curl_easy_setopt(result, CURLOPT_PROXY, curl_http_proxy); curl_easy_setopt(result, CURLOPT_PROXYAUTH, CURLAUTH_ANY); +#if LIBCURL_VERSION_NUM >= 0x071800 + if (starts_with(curl_http_proxy, "socks5")) + curl_easy_setopt(result, + CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); + else if (starts_with(curl_http_proxy, "socks4a")) + curl_easy_setopt(result, + CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4A); + else if (starts_with(curl_http_proxy, "socks")) + curl_easy_setopt(result, + CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); +#endif } set_curl_keepalive(result); From d7255ab6a893b9da22c8c91d984bfa0a3b5af3ca Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 24 Feb 2015 19:20:13 +0000 Subject: [PATCH 4/6] Facilitate debugging Git executables in tests with gdb When prefixing a Git call in the test suite with 'TEST_GDB_GIT=1 ', it will now be run with GDB, allowing the developer to debug test failures more conveniently. Signed-off-by: Johannes Schindelin --- wrap-for-bin.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh index 701d2339b9..a151c95d4c 100644 --- a/wrap-for-bin.sh +++ b/wrap-for-bin.sh @@ -19,4 +19,11 @@ GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale' PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH" export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR +if test -n "$TEST_GDB_GIT" +then + exec gdb -args "${GIT_EXEC_PATH}/@@PROG@@" "$@" + echo "Could not run gdb -args ${GIT_EXEC_PATH}/@@PROG@@ $*" >&2 + exit 1 +fi + exec "${GIT_EXEC_PATH}/@@PROG@@" "$@" From 081ea0f65b091b425d66f508786d7bd77c5b0c94 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 31 Mar 2015 17:14:55 +0100 Subject: [PATCH 5/6] Squelch warning about an integer overflow We cannot rely on long integers to have more than 32 bits... Signed-off-by: Johannes Schindelin --- git-compat-util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-compat-util.h b/git-compat-util.h index 35b3fe0b3b..5b188ca016 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -514,7 +514,7 @@ extern int git_lstat(const char *, struct stat *); #endif #define DEFAULT_PACKED_GIT_LIMIT \ - ((1024L * 1024L) * (sizeof(void*) >= 8 ? 8192 : 256)) + ((1024L * 1024L) * (size_t)(sizeof(void*) >= 8 ? 8192 : 256)) #ifdef NO_PREAD #define pread git_pread From 2e91cfe6539528d74c2457eb1062ed1b65cfb008 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 31 Mar 2015 18:07:05 +0100 Subject: [PATCH 6/6] Silence GCC's "cast of pointer to integer of a different size" warning When calculating hashes from pointers, it actually makes sense to cut off the most significant bits. In that case, said warning does not make a whole lot of sense. So let's just work around it. Signed-off-by: Johannes Schindelin --- compat/regex/regcomp.c | 6 ++++-- pack-revindex.c | 2 +- sha1_file.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/compat/regex/regcomp.c b/compat/regex/regcomp.c index 06f3088708..fba5986399 100644 --- a/compat/regex/regcomp.c +++ b/compat/regex/regcomp.c @@ -18,6 +18,8 @@ Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include + static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern, size_t length, reg_syntax_t syntax); static void re_compile_fastmap_iter (regex_t *bufp, @@ -2577,7 +2579,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, old_tree = NULL; if (elem->token.type == SUBEXP) - postorder (elem, mark_opt_subexp, (void *) (long) elem->token.opr.idx); + postorder (elem, mark_opt_subexp, (void *) (intptr_t) elem->token.opr.idx); tree = create_tree (dfa, elem, NULL, (end == -1 ? OP_DUP_ASTERISK : OP_ALT)); if (BE (tree == NULL, 0)) @@ -3806,7 +3808,7 @@ create_token_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, static reg_errcode_t mark_opt_subexp (void *extra, bin_tree_t *node) { - int idx = (int) (long) extra; + int idx = (int) (intptr_t) extra; if (node->token.type == SUBEXP && node->token.opr.idx == idx) node->token.opt_subexp = 1; diff --git a/pack-revindex.c b/pack-revindex.c index 5c8376e978..e542ea7703 100644 --- a/pack-revindex.c +++ b/pack-revindex.c @@ -21,7 +21,7 @@ static int pack_revindex_hashsz; static int pack_revindex_ix(struct packed_git *p) { - unsigned long ui = (unsigned long)p; + unsigned long ui = (unsigned long)(intptr_t)p; int i; ui = ui ^ (ui >> 16); /* defeat structure alignment */ diff --git a/sha1_file.c b/sha1_file.c index 88f06bac92..77efc0e8a9 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2017,7 +2017,7 @@ static unsigned long pack_entry_hash(struct packed_git *p, off_t base_offset) { unsigned long hash; - hash = (unsigned long)p + (unsigned long)base_offset; + hash = (unsigned long)(intptr_t)p + (unsigned long)base_offset; hash += (hash >> 8) + (hash >> 16); return hash % MAX_DELTA_CACHE; }