MCPcopy Index your code
hub / github.com/rilldata/rill / TestCommitAndSafePush_SubpathIsolation

Function TestCommitAndSafePush_SubpathIsolation

cli/pkg/cmdutil/helper_test.go:182–205  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

180}
181
182func TestCommitAndSafePush_SubpathIsolation(t *testing.T) {
183 tempDir, remoteDir := setupMonorepoTestRepository(t)
184 h := minimalHelper()
185
186 // Create local changes in subproject1 (uncommitted)
187 createFile(t, tempDir, "subproject1/local.txt", "local content")
188
189 // Create remote changes in subproject2 (different subpath)
190 createRemoteCommit(t, remoteDir, "subproject2/remote.txt", "remote content", "add remote file to subproject2")
191
192 config := &gitutil.Config{
193 Remote: remoteDir,
194 DefaultBranch: getCurrentBranch(t, tempDir),
195 Subpath: "subproject1",
196 }
197
198 // Should succeed because remote commits in subproject2 don't affect subproject1
199 err := h.CommitAndSafePush(context.Background(), tempDir, config, "test commit", author, "1")
200 require.NoError(t, err, "CommitAndSafePush should succeed when remote commits are in different subpath")
201
202 // Verify local file exists in subproject1 and subproject2
203 assertFileExists(t, tempDir, "subproject1/local.txt")
204 assertFileExists(t, tempDir, "subproject2/remote.txt")
205}
206
207// Helper functions
208

Callers

nothing calls this directly

Calls 7

minimalHelperFunction · 0.85
CommitAndSafePushMethod · 0.80
createFileFunction · 0.70
createRemoteCommitFunction · 0.70
getCurrentBranchFunction · 0.70
assertFileExistsFunction · 0.70

Tested by

no test coverage detected