Files
Githug-Android/app/src/main/java/solutions/tretter/githugandroid/levels/BranchLevel.kt
Joe Tretter 781b5090f7 Fix Git editor reword workflow and UI coverage
- show Git editor file paths instead of the submitted git command
- surface follow-up commit message editors during interactive rebase reword
- add rename-commit UI tests for editor and amend-message solution paths
- add broader embedded level solution scenarios for alternate Git workflows
2026-06-26 11:23:16 -05:00

23 lines
1.1 KiB
Kotlin

package solutions.tretter.githugandroid
/**
* Port of the upstream ruby-githug `branch` 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 branchLevel(): Level = level(
id = "branch",
title = "Branch",
description = "To work on a piece of code that has the potential to break things, create the branch test_code.",
hints = listOf("`git branch` is what you want to investigate."),
commandSuggestions = listOf("git branch test_code"),
setup = { RepoState(initialized = true, files = listOf(GitFile("README", tracked = true)), commits = listOf(CommitNode("0000001", "Initial commit")), branches = mapOf("master" to 1)) },
validator = repoPredicate { repo -> "test_code" in repo.branches && repo.headBranch == "master" },
testCases = listOf(
levelTestCase("create branch", "git branch test_code"),
levelTestCase("create branch from master", "git branch test_code master"),
),
)