(c *C, cfg *config.Config)
| 97 | } |
| 98 | |
| 99 | func (s *OptionsSuite) writeGlobalConfig(c *C, cfg *config.Config) func() { |
| 100 | fs := s.TemporalFilesystem(c) |
| 101 | |
| 102 | tmp, err := util.TempDir(fs, "", "test-options") |
| 103 | c.Assert(err, IsNil) |
| 104 | |
| 105 | err = fs.MkdirAll(fs.Join(tmp, "git"), 0777) |
| 106 | c.Assert(err, IsNil) |
| 107 | |
| 108 | os.Setenv("XDG_CONFIG_HOME", fs.Join(fs.Root(), tmp)) |
| 109 | |
| 110 | content, err := cfg.Marshal() |
| 111 | c.Assert(err, IsNil) |
| 112 | |
| 113 | cfgFile := fs.Join(tmp, "git/config") |
| 114 | err = util.WriteFile(fs, cfgFile, content, 0777) |
| 115 | c.Assert(err, IsNil) |
| 116 | |
| 117 | return func() { |
| 118 | os.Setenv("XDG_CONFIG_HOME", "") |
| 119 | |
| 120 | } |
| 121 | } |
no test coverage detected