Speed up runtime state refresh

This commit is contained in:
Joe Tretter
2026-06-24 17:44:53 -05:00
parent 0554c736e4
commit 1c15297ae6
7 changed files with 180 additions and 22 deletions

View File

@@ -258,6 +258,48 @@ class GitSandboxEngineTest {
}
}
@Test
fun nativeConfigLevelSolvesAfterSettingNameAndEmail() {
val git = testGitBinary()
assumeTrue(git.exists() && git.canExecute())
val root = Files.createTempDirectory("githug-config-level").toFile()
try {
val runtime = GitRepositoryRuntime(root, git)
val level = configLevel()
val repo = runtime.prepareLevel(level)
val (namedRepo, _) = runtime.execute(level, repo, "git config user.name GitHug")
val (configuredRepo, _) = runtime.execute(level, namedRepo, "git config user.email githug@example.com")
assertEquals("GitHug", configuredRepo.config["user.name"])
assertEquals("githug@example.com", configuredRepo.config["user.email"])
assertTrue(level.validator(configuredRepo, "git config user.email githug@example.com"))
} finally {
root.deleteRecursively()
}
}
@Test
fun nativeReadOnlyHelperCommandsDoNotRefreshAwayTransientState() {
val git = testGitBinary()
assumeTrue(git.exists() && git.canExecute())
val root = Files.createTempDirectory("githug-read-only-helper").toFile()
try {
val runtime = GitRepositoryRuntime(root, git)
val level = configLevel()
val repo = runtime.prepareLevel(level).copy(
maintenanceActions = setOf("transient-marker"),
)
val (listedRepo, output) = runtime.execute(level, repo, "ls")
assertTrue(".git" in output)
assertEquals(setOf("transient-marker"), listedRepo.maintenanceActions)
} finally {
root.deleteRecursively()
}
}
@Test
fun nativeGitExecAliasesRefreshWhenBinaryChanges() {
val git = testGitBinary()