- 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
25 lines
1.2 KiB
Kotlin
25 lines
1.2 KiB
Kotlin
package solutions.tretter.githugandroid
|
|
|
|
/**
|
|
* Port of the upstream ruby-githug `add` 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 addLevel(): Level = level(
|
|
id = "add",
|
|
title = "Add",
|
|
description = "There is a file in your folder called `README`; add it to your staging area.\nNote: Each level starts with a new repo. Don't look for files of the previous one.",
|
|
hints = listOf("You can type `git` in your shell to get a list of available git commands."),
|
|
commandSuggestions = listOf("git add README", "git status"),
|
|
setup = { RepoState(initialized = true, files = listOf(GitFile("README")), branches = mapOf("master" to 0)) },
|
|
validator = repoPredicate { repo -> repo.files.any { it.name == "README" && it.staged } },
|
|
testCases = listOf(
|
|
levelTestCase("add exact file", "git add README"),
|
|
levelTestCase("add all", "git add ."),
|
|
levelTestCase("stage exact file", "git stage README"),
|
|
levelTestCase("add with path separator", "git add -- README"),
|
|
),
|
|
)
|