diff options
author | Jeff King <peff@peff.net> | 2012-06-02 15:01:12 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-06-03 13:11:52 -0700 |
commit | 42dcbb738b47ab7e2b265ed981c9a4a7bda92f97 (patch) | |
tree | 2a374e2aed5c26b6921dc3636795714a5cdb6997 /version.c | |
parent | 816fb46be665c8b63647f0096845fef363736b20 (diff) | |
download | git-42dcbb738b47ab7e2b265ed981c9a4a7bda92f97.tar.gz |
version: add git_user_agent function
This is basically a fancy way of saying "git/$GIT_VERSION",
except that it is overridable at build-time and through the
environment. Which means that people who don't want to
advertise their git version (for privacy or security
reasons) can tweak it.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'version.c')
-rw-r--r-- | version.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -2,3 +2,16 @@ #include "version.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; +} |