1
// Copyright 2013 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
9
. "launchpad.net/gocheck"
12
type GitSuite struct {
13
oldValues map[string]string
16
// We ensure that Git is told about the user name and email if the setup under which the
17
// tests are run does not already provide that information. These git env variables are used for
19
var gitEnvVars = []string{
23
"GIT_COMMITTER_EMAIL",
26
func (t *GitSuite) SetUpTest(c *C) {
27
t.oldValues = make(map[string]string)
28
for _, v := range gitEnvVars {
29
t.oldValues[v] = os.Getenv(v)
31
if t.oldValues["GIT_AUTHOR_NAME"] == "" {
32
os.Setenv("GIT_AUTHOR_NAME", "Foo Bar")
34
if t.oldValues["GIT_AUTHOR_EMAIL"] == "" {
35
os.Setenv("GIT_AUTHOR_EMAIL", "foo@example.org")
37
os.Setenv("GIT_COMMITTER_NAME", "$GIT_AUTHOR_NAME")
38
os.Setenv("GIT_COMMITTER_EMAIL", "$GIT_AUTHOR_EMAIL")
41
func (t *GitSuite) TearDownTest(c *C) {
42
for k, v := range t.oldValues {