Speed up runtime state refresh
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user