Say what a worktree run refuses, and test the refusals - #168
Merged
Conversation
Closes the four doc and test gaps the worktree-runs review left open. `Worktrees`' object doc talked about "the two reads", which the object has outgrown; it now states the rule for all of them, and names `mainCheckoutOrReason` as the read that gives a reason instead. `WorktreeRun.resolve`'s doc listed three of the messages a caller can get back. It lists all of them now. Two of the three "no main checkout" messages had no test: the one for a repository whose main worktree is not a checkout, and the one for a git that does not answer the query. Both are covered. `headBranch` and `onABranch` answer "not on a branch" when a worktree cannot be read at all, which nothing tested. The new test deletes the worktree directory first, so git really cannot answer. The separate-git-dir repo two tests were building inline is now `GitRepo.seededSeparateGitDir`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the four doc and test gaps the review of #166 left open. Docs and
tests only — no behaviour change.
Worktrees' object doc talked about "the two reads", which the objecthas outgrown. It now states the rule for all of the reads, and names
mainCheckoutOrReasonas the one that gives a reason instead of a blank"not known".
WorktreeRun.resolve's doc listed three of the messages a caller canget back. It lists all of them now, and says what each one means.
Two of the three "no main checkout" messages had no test: the one for
a repository whose main worktree is not a checkout (
--separate-git-diror a submodule), and the one for a git that does not answer the query.
The second is reached with a repository path holding a newline, which
makes git's answer unreadable in the same way an old git does.
headBranchandonABranchanswer "not on a branch" when a worktreecannot be read at all, which nothing tested. The new test deletes the
worktree directory first, so git really cannot be run there; it fails if
that fail-closed answer is taken out. os-lib prints the failed exec's
stack trace from a thread of its own, so the test log shows it while
passing — noted in the test.
The
--separate-git-dirrepo two tests were building inline is nowGitRepo.seededSeparateGitDir.sbt scalafmtAllandsbt testare green: 2239 tests, 0 failures.