Revision c285171dacb2e3fbcb644ad16b14b2cb1875947d authored by Junio C Hamano on 25 August 2014, 22:12:58 UTC, committed by Junio C Hamano on 25 August 2014, 22:12:58 UTC
* git://github.com/git-l10n/git-po:
  l10n: de.po: improve message when switching branches
  l10n: de.po: fix typo
  po/TEAMS: Add Catalan team
  l10n: Add Catalan translation
  l10n: fr.po (2257t) update for version 2.1.0
  l10n: sv.po: Update Swedish translation (2257t0f0u)
  l10n: vi.po (2257t): Update translation
  l10n: Updated Bulgarian translation of git (2257t,0f,0u)
  l10n: zh_CN: translations for git v2.1.0-rc0
  l10n: git.pot: v2.1.0 round 1 (38 new, 9 removed)
  l10n: Updated Bulgarian translation of git (2247t,0f,0u)
  l10n: Updated Bulgarian translation of git (2228t,0f,0u)
  l10n: Fix more typos in the Swedish translations
2 parent s 6c4ab27 + 869951b
Raw File
version.c
#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;
}
back to top