Refresh native Git helper aliases after app upgrade

- Rebuild the app-private git-exec helper directory when the packaged native Git binary changes.
- Remove stale helper aliases before recreating symlinks/copies.
- Add regression coverage for refreshing cached Git exec aliases across binary changes.
This commit is contained in:
Joe Tretter
2026-05-11 21:48:14 -05:00
parent 4bac818571
commit 75c8396f00
3 changed files with 54 additions and 2 deletions

View File

@@ -185,6 +185,37 @@ class GitSandboxEngineTest {
}
}
@Test
fun nativeGitExecAliasesRefreshWhenBinaryChanges() {
val git = testGitBinary()
assumeTrue(git.exists() && git.canExecute())
val root = Files.createTempDirectory("githug-exec-refresh").toFile()
try {
val firstGit = File(root, "first-git").also { git.copyTo(it); it.setExecutable(true) }
val secondGit = File(root, "second-git").also { git.copyTo(it); it.setExecutable(true) }
val level = level(
id = "exec-refresh-test",
title = "Exec Refresh Test",
description = "",
hints = emptyList(),
commandSuggestions = emptyList(),
setup = { RepoState(initialized = true) },
validator = { _, _ -> false },
)
GitRepositoryRuntime(root, firstGit).prepareLevel(level)
val alias = File(root, "git-exec/git")
assertTrue(alias.exists())
assertTrue(File(root, "git-exec/.binary-fingerprint").readText().contains(firstGit.absolutePath))
GitRepositoryRuntime(root, secondGit).prepareLevel(level)
assertTrue(alias.exists())
assertTrue(File(root, "git-exec/.binary-fingerprint").readText().contains(secondGit.absolutePath))
} finally {
root.deleteRecursively()
}
}
@Test
fun nativePushLevelHasDivergedStatusAndRebasesCleanly() {
val git = testGitBinary()