Files
Githug-Android/app/src/main/java/solutions/tretter/githugandroid/levels/ConfigLevel.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

24 lines
1.3 KiB
Kotlin

package solutions.tretter.githugandroid
/**
* Port of the upstream ruby-githug `config` 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 configLevel(): Level = level(
id = "config",
title = "Config",
description = "Set up your git name and email; this is important so that your commits can be identified.",
hints = listOf("Use `git config user.name ...` and `git config user.email ...`."),
commandSuggestions = listOf("git config user.name GitHug", "git config user.email githug@example.com"),
setup = { RepoState(initialized = true, branches = mapOf("master" to 0)) },
validator = repoPredicate { repo -> repo.config["user.name"].orEmpty().isNotBlank() && repo.config["user.email"].orEmpty().isNotBlank() },
testCases = listOf(
levelTestCase("name then email", "git config user.name GitHug", "git config user.email githug@example.com"),
levelTestCase("email then name", "git config user.email githug@example.com", "git config user.name GitHug"),
levelTestCase("explicit local config", "git config --local user.name GitHug", "git config --local user.email githug@example.com"),
),
)