1 #include "git-compat-util.h"
5 const char git_version_string
[] = GIT_VERSION
;
6 const char git_built_from_commit_string
[] = GIT_BUILT_FROM_COMMIT
;
8 const char *git_user_agent(void)
10 static const char *agent
= NULL
;
13 agent
= getenv("GIT_USER_AGENT");
15 agent
= GIT_USER_AGENT
;
21 const char *git_user_agent_sanitized(void)
23 static const char *agent
= NULL
;
26 struct strbuf buf
= STRBUF_INIT
;
29 strbuf_addstr(&buf
, git_user_agent());
31 for (i
= 0; i
< buf
.len
; i
++) {
32 if (buf
.buf
[i
] <= 32 || buf
.buf
[i
] >= 127)