From 36e1f5b74cb7fc57e6bbbcfeca66eb79a644c86b Mon Sep 17 00:00:00 2001 From: 🚀 Steven Ewing 🌌 Date: Fri, 20 May 2022 14:05:47 -0700 Subject: plumbing: packp and server, Include the contents of `GO_GIT_USER_AGENT_EXTRA` as the git user agent. Fixes #529 --- .../protocol/packp/capability/capability_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 plumbing/protocol/packp/capability/capability_test.go (limited to 'plumbing/protocol/packp/capability/capability_test.go') diff --git a/plumbing/protocol/packp/capability/capability_test.go b/plumbing/protocol/packp/capability/capability_test.go new file mode 100644 index 0000000..f1fd028 --- /dev/null +++ b/plumbing/protocol/packp/capability/capability_test.go @@ -0,0 +1,22 @@ +package capability + +import ( + "fmt" + "os" + + check "gopkg.in/check.v1" +) + +var _ = check.Suite(&SuiteCapabilities{}) + +func (s *SuiteCapabilities) TestDefaultAgent(c *check.C) { + os.Unsetenv("GO_GIT_USER_AGENT_EXTRA") + ua := DefaultAgent() + c.Assert(ua, check.Equals, userAgent) +} + +func (s *SuiteCapabilities) TestEnvAgent(c *check.C) { + os.Setenv("GO_GIT_USER_AGENT_EXTRA", "abc xyz") + ua := DefaultAgent() + c.Assert(ua, check.Equals, fmt.Sprintf("%s %s", userAgent, "abc xyz")) +} -- cgit