http: get default user-agent from git_user_agent
authorJeff King <peff@peff.net>
Sat, 2 Jun 2012 19:03:08 +0000 (15:03 -0400)
committerJunio C Hamano <gitster@pobox.com>
Sun, 3 Jun 2012 20:11:54 +0000 (13:11 -0700)
This means we will respect the GIT_USER_AGENT build-time
configuration and run-time environment variable.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
http.c

index e6e65cac4580bc0aad560207375a992227c4e996..62de0b42b95504cc5ae0719e27d7e4f6937cbebe 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2104,7 +2104,7 @@ configure: configure.ac
        $(RM) $<+
 
 # These can record GIT_VERSION
-version.o git.spec http.o \
+version.o git.spec \
        $(patsubst %.sh,%,$(SCRIPT_SH)) \
        $(patsubst %.perl,%,$(SCRIPT_PERL)) \
        : GIT-VERSION-FILE
@@ -2274,9 +2274,6 @@ attr.sp attr.s attr.o: EXTRA_CPPFLAGS = \
 gettext.sp gettext.s gettext.o: EXTRA_CPPFLAGS = \
        -DGIT_LOCALE_PATH='"$(localedir_SQ)"'
 
-http.sp http.s http.o: EXTRA_CPPFLAGS = \
-       -DGIT_HTTP_USER_AGENT='"git/$(GIT_VERSION)"'
-
 ifdef NO_EXPAT
 http-walker.sp http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
 endif
diff --git a/http.c b/http.c
index 5cb87f16f25fe3d32e2594c8c6325d562eddc9ca..b61ac85d4b19a0b9121c5b19f2b9c731bbb238d4 100644 (file)
--- a/http.c
+++ b/http.c
@@ -4,6 +4,7 @@
 #include "run-command.h"
 #include "url.h"
 #include "credential.h"
+#include "version.h"
 
 int active_requests;
 int http_is_verbose;
@@ -299,7 +300,7 @@ static CURL *get_curl_handle(void)
                curl_easy_setopt(result, CURLOPT_VERBOSE, 1);
 
        curl_easy_setopt(result, CURLOPT_USERAGENT,
-               user_agent ? user_agent : GIT_HTTP_USER_AGENT);
+               user_agent ? user_agent : git_user_agent());
 
        if (curl_ftp_no_epsv)
                curl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0);