Move native level setups into level files

- Delete NativeLevelFixtures.kt and make native repository setup an optional property of each Level.
- Move every existing native setup into its corresponding level file so setup, validation, and tests stay together.
- Add the missing Blame native setup with config.rb history and a Spider Man password commit.
- Add a native runtime regression that verifies `git blame config.rb` identifies Spider Man on the password line.
- Verify the full JVM test suite using the compiled host Git runtime.
This commit is contained in:
Joe Tretter
2026-05-07 18:53:18 -05:00
parent 7bfb761068
commit 64743ff4a9
30 changed files with 580 additions and 505 deletions

View File

@@ -1,5 +1,7 @@
package solutions.tretter.githugandroid
import java.io.File
/**
* Port of the upstream ruby-githug `pull` level.
*
@@ -14,6 +16,22 @@ internal fun pullLevel(): Level = level(
hints = listOf("Check out the remote repositories and research `git pull`."),
commandSuggestions = listOf("git pull origin master"),
setup = { RepoState(initialized = true, remotes = mapOf("origin" to "remote"), branches = mapOf("master" to 1)) },
nativeSetup = {
resetFiles()
write("local_file")
addCommit("Initial local commit", "local_file")
val remote = siblingRepo("origin")
git("remote", "add", "pull-setup-origin", File(remote, ".git").absolutePath)
git("push", "pull-setup-origin", "master")
git("remote", "remove", "pull-setup-origin")
git(remote, "checkout", "-f", "master")
writeIn(remote, "remote_file", "pulled from origin\n")
addCommitIn(remote, "Pulled commit", "remote_file")
git("remote", "add", "origin", File(remote, ".git").absolutePath)
git("config", "branch.master.remote", "origin")
git("config", "branch.master.merge", "refs/heads/master")
true
},
validator = repoPredicate { repo ->
"origin/master" in repo.fetchedBranches &&
repo.files.any { it.name == "remote_file" && it.tracked } &&