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

26 lines
1.2 KiB
Kotlin

package solutions.tretter.githugandroid
/**
* Port of the upstream ruby-githug `rm` 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 rmLevel(): Level = level(
id = "rm",
title = "Rm",
description = "A file has been removed from the working tree, but not from the repository. Identify this file and remove it.",
hints = emptyList(),
commandSuggestions = listOf("git status", "git rm deleteme.rb"),
setup = { RepoState(initialized = true, files = listOf(GitFile("deleteme.rb", tracked = true, deleted = true)), commits = listOf(CommitNode("0000001", "Added a temp file")), branches = mapOf("master" to 1)) },
validator = repoPredicate { repo ->
repo.files.none { it.name == "deleteme.rb" } ||
repo.files.any { it.name == "deleteme.rb" && it.deleted && it.staged }
},
testCases = listOf(
levelTestCase("git rm deleted path", "git rm deleteme.rb"),
levelTestCase("stage deleted path", "git add -u deleteme.rb"),
),
)