1 #include "git-compat-util.h"
6 # include "version-def.h"
8 # include GIT_VERSION_H
11 const char git_version_string
[] = GIT_VERSION
;
12 const char git_built_from_commit_string
[] = GIT_BUILT_FROM_COMMIT
;
14 const char *git_user_agent(void)
16 static const char *agent
= NULL
;
19 agent
= getenv("GIT_USER_AGENT");
21 agent
= GIT_USER_AGENT
;
27 const char *git_user_agent_sanitized(void)
29 static const char *agent
= NULL
;
32 struct strbuf buf
= STRBUF_INIT
;
34 strbuf_addstr(&buf
, git_user_agent());
36 for (size_t i
= 0; i
< buf
.len
; i
++) {
37 if (buf
.buf
[i
] <= 32 || buf
.buf
[i
] >= 127)