(t *testing.T)
| 180 | } |
| 181 | |
| 182 | func 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 |
nothing calls this directly
no test coverage detected