Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: v1.7.12.3
Fetching contributors…

Cannot retrieve contributors at this time

file 38 lines (30 sloc) 0.651 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
#include "git-compat-util.h"
#include "version.h"
#include "strbuf.h"

const char git_version_string[] = GIT_VERSION;

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;
}
Something went wrong with that request. Please try again.