merge(third_party/git): Merge squashed git subtree at v2.23.0
Merge commit '1b593e1ea4' as 'third_party/git'
This commit is contained in:
commit
7ef0d62730
3629 changed files with 1139935 additions and 0 deletions
39
third_party/git/version.c
vendored
Normal file
39
third_party/git/version.c
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#include "git-compat-util.h"
|
||||
#include "version.h"
|
||||
#include "strbuf.h"
|
||||
|
||||
const char git_version_string[] = GIT_VERSION;
|
||||
const char git_built_from_commit_string[] = GIT_BUILT_FROM_COMMIT;
|
||||
|
||||
const char *git_user_agent(void)
|
||||
{
|
||||
static const char *agent = NULL;
|
||||
|
||||
if (!agent) {
|
||||
agent = getenv("GIT_USER_AGENT");
|
||||
if (!agent)
|
||||
agent = GIT_USER_AGENT;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue