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 `squash` 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 squashLevel(): Level = level(
id = "squash",
title = "Squash",
description = "You have committed several times but would like all those changes to be one commit.",
hints = listOf("Take a look at the `-i` flag of the rebase command."),
commandSuggestions = listOf("git rebase -i HEAD~4"),
setup = { RepoState(initialized = true, commits = listOf(CommitNode("1", "Initial Commit"), CommitNode("2", "Adding README"), CommitNode("3", "Updating README (squash this commit into Adding README)"), CommitNode("4", "Updating README (squash this commit into Adding README)"), CommitNode("5", "Updating README (squash this commit into Adding README)")), branches = mapOf("master" to 5)) },
validator = repoPredicate { repo -> repo.commits.size <= 2 && repo.commits.any { it.message == "Adding README" } },
testCases = listOf(
levelTestCase("interactive squash", "git rebase -i HEAD~4"),
),
)