summaryrefslogtreecommitdiff
path: root/version.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-08-29 21:50:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-08-29 21:50:07 (GMT)
commit97349a2a74fdd42afd5a1f8e8e92cddf47f28193 (patch)
tree1bf6c7e35ff92704b01e56fcbd356eca19bd2585 /version.c
parent4514de70c2e006f6b817498bf941d2b789feaaa7 (diff)
parent36c60f7a08b28e2cee649d697291ac6b708b213f (diff)
downloadgit-97349a2a74fdd42afd5a1f8e8e92cddf47f28193.zip
git-97349a2a74fdd42afd5a1f8e8e92cddf47f28193.tar.gz
git-97349a2a74fdd42afd5a1f8e8e92cddf47f28193.tar.bz2
Merge branch 'jc/capabilities'
Some capabilities were asked by fetch-pack even when upload-pack did not advertise that they are available. Fix fetch-pack not to do so. * jc/capabilities: fetch-pack: mention server version with verbose output parse_feature_request: make it easier to see feature values fetch-pack: do not ask for unadvertised capabilities do not send client agent unless server does first send-pack: fix capability-sending logic include agent identifier in capability string
Diffstat (limited to 'version.c')
-rw-r--r--version.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/version.c b/version.c
index f98d5a6..6106a80 100644
--- a/version.c
+++ b/version.c
@@ -1,5 +1,6 @@
#include "git-compat-util.h"
#include "version.h"
+#include "strbuf.h"
const char git_version_string[] = GIT_VERSION;
@@ -15,3 +16,23 @@ const char *git_user_agent(void)
return agent;
}
+
+const char *git_user_agent_sanitized(void)
+{
+ static const char *agent = NULL;
+
+ if (!agent) {
+ struct strbuf buf = STRBUF_INIT;
+ int i;
+
+ strbuf_addstr(&buf, git_user_agent());
+ strbuf_trim(&buf);
+ for (i = 0; i < buf.len; i++) {
+ if (buf.buf[i] <= 32 || buf.buf[i] >= 127)
+ buf.buf[i] = '.';
+ }
+ agent = buf.buf;
+ }
+
+ return agent;
+}