summaryrefslogtreecommitdiff
path: root/version.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-06-21 14:42:01 -0700
committerJunio C Hamano <gitster@pobox.com>2012-06-21 14:42:01 -0700
commit9d8d51d53b53e32bd2b642676f6f1798e2a0897b (patch)
tree5d72f251281567965c7defac9ebcd67c9f29c79e /version.c
parent2b022f62ab26be1a51b1be9c76f3e73e3a5a2b38 (diff)
parent745c7c8e6252ba41430a1442e1fa8da2ec40e9c2 (diff)
downloadgit-9d8d51d53b53e32bd2b642676f6f1798e2a0897b.tar.gz
Merge branch 'jk/version-string'
Teaches git native protocol agents to show software version over the wire. * jk/version-string: http: get default user-agent from git_user_agent version: add git_user_agent function move git_version_string into version.c
Diffstat (limited to 'version.c')
-rw-r--r--version.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/version.c b/version.c
new file mode 100644
index 0000000000..f98d5a654d
--- /dev/null
+++ b/version.c
@@ -0,0 +1,17 @@
+#include "git-compat-util.h"
+#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;
+}