MCPcopy
hub / github.com/go-git/go-git / writeGlobalConfig

Method writeGlobalConfig

options_test.go:99–121  ·  view source on GitHub ↗
(c *C, cfg *config.Config)

Source from the content-addressed store, hash-verified

97}
98
99func (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}

Calls 5

JoinMethod · 0.80
RootMethod · 0.80
TemporalFilesystemMethod · 0.45
MkdirAllMethod · 0.45
MarshalMethod · 0.45

Tested by

no test coverage detected