MCPcopy Create free account
hub / github.com/cli/cli / TestIsolateConfigClearsRepositoryRoutingEnvironment

Function TestIsolateConfigClearsRepositoryRoutingEnvironment

git/test_test.go:128–159  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

126}
127
128func TestIsolateConfigClearsRepositoryRoutingEnvironment(t *testing.T) {
129 // Given ambient environment that can redirect Git repository state
130 variables := []string{
131 "GIT_DIR",
132 "GIT_WORK_TREE",
133 "GIT_COMMON_DIR",
134 "GIT_CONFIG",
135 "GIT_INDEX_FILE",
136 "GIT_INDEX_VERSION",
137 "GIT_OBJECT_DIRECTORY",
138 "GIT_ALTERNATE_OBJECT_DIRECTORIES",
139 "GIT_NAMESPACE",
140 "GIT_SHALLOW_FILE",
141 "GIT_CEILING_DIRECTORIES",
142 "GIT_DISCOVERY_ACROSS_FILESYSTEM",
143 "GIT_TEMPLATE_DIR",
144 "GIT_DEFAULT_HASH",
145 "GIT_DEFAULT_REF_FORMAT",
146 }
147 for _, variable := range variables {
148 t.Setenv(variable, "ambient")
149 }
150
151 // When Git configuration is isolated
152 IsolateConfig(t)
153
154 // Then repository routing and initialization variables are removed
155 for _, variable := range variables {
156 _, found := os.LookupEnv(variable)
157 assert.Falsef(t, found, "expected %s to be unset", variable)
158 }
159}

Callers

nothing calls this directly

Calls 1

IsolateConfigFunction · 0.85

Tested by

no test coverage detected