Misc Changes

This commit is contained in:
Joe Tretter
2026-05-06 21:28:44 -05:00
parent 5727022baf
commit e1b2d7f7a1
64 changed files with 1662 additions and 300 deletions

View File

@@ -0,0 +1,21 @@
package solutions.tretter.githugandroid
/**
* Port of the upstream ruby-githug `revert` level.
*
* Setup documents the repository shape the learner explores. Evaluation is kept
* state-based whenever the exercise changes repository objects; answer-only
* levels intentionally validate the answer entered at the prompt.
*/
internal fun revertLevel(): Level = level(
id = "revert",
title = "Revert",
description = "You have committed several times but want to undo the middle commit. All commits have been pushed, so you can't change existing history.",
hints = listOf("Try the revert command."),
commandSuggestions = listOf("git revert HEAD~1"),
setup = { RepoState(initialized = true, commits = listOf(CommitNode("1", "First commit"), CommitNode("2", "Bad commit"), CommitNode("3", "Second commit")), branches = mapOf("master" to 3), pushedBranches = setOf("origin/master")) },
validator = repoPredicate { repo -> repo.commits.any { it.message.startsWith("Revert") } },
testCases = listOf(
levelTestCase("revert middle commit", "git revert HEAD~1"),
),
)