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

39 lines
1.5 KiB
Kotlin

package solutions.tretter.githugandroid
/**
* Port of the upstream ruby-githug `merge` 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 mergeLevel(): Level = level(
id = "merge",
title = "Merge",
description = "We have a file in the branch 'feature'. Let's merge it with the master branch.",
hints = listOf("You want to research the `git merge` command."),
commandSuggestions = listOf("git merge feature"),
setup = { RepoState(initialized = true, files = listOf(GitFile("file1", tracked = true)), branches = mapOf("master" to 1, "feature" to 2)) },
nativeSetup = {
resetFiles()
write("file1")
addCommit("added file1", "file1")
checkoutNew("feature")
write("file2")
addCommit("added file2", "file2")
checkout("master")
true
},
validator = repoPredicate { repo ->
repo.headBranch == "master" &&
repo.files.any { it.name == "file2" && it.tracked }
},
testCases = listOf(
levelTestCase("merge feature", "git merge feature"),
levelTestCase("merge feature with explicit merge commit", "git merge --no-ff feature -m \"Merge feature\""),
),
negativeTestCases = listOf(
levelTestCase("switching to feature does not solve", "git switch feature"),
),
)