THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
718B

  1. #include "git-compat-util.h"
  2. #include "version.h"
  3. #include "strbuf.h"
  4. const char git_version_string[] = GIT_VERSION;
  5. const char git_built_from_commit_string[] = GIT_BUILT_FROM_COMMIT;
  6. const char *git_user_agent(void)
  7. {
  8. static const char *agent = NULL;
  9. if (!agent) {
  10. agent = getenv("GIT_USER_AGENT");
  11. if (!agent)
  12. agent = GIT_USER_AGENT;
  13. }
  14. return agent;
  15. }
  16. const char *git_user_agent_sanitized(void)
  17. {
  18. static const char *agent = NULL;
  19. if (!agent) {
  20. struct strbuf buf = STRBUF_INIT;
  21. int i;
  22. strbuf_addstr(&buf, git_user_agent());
  23. strbuf_trim(&buf);
  24. for (i = 0; i < buf.len; i++) {
  25. if (buf.buf[i] <= 32 || buf.buf[i] >= 127)
  26. buf.buf[i] = '.';
  27. }
  28. agent = buf.buf;
  29. }
  30. return agent;
  31. }