Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ The English README is the source of truth; localized READMEs may lag.

## Unreleased

### Fixed
- Clarified `vch land` wrong-branch diagnostics so resolved `--into`
failures show the target branch and no longer suggest passing
`--into` again (#124).

## 0.9.1 - 2026-05-15

### Changed
Expand Down
2 changes: 1 addition & 1 deletion Sources/VibeChardCore/Domain/Errors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public enum VibeChardError: Error, CustomStringConvertible {
return "no log file at \(path) — \(hint)"
case let .landMainNotOnInto(currentBranch, want):
let cur = currentBranch.map { "'\($0)'" } ?? "(detached HEAD)"
return "refusing to land: main worktree is on \(cur), not '\(want)' (use `git switch \(want)` first or pass --into)"
return "refusing to land: target branch is '\(want)', but the main worktree is currently on \(cur); run `git switch \(want)` first from the main worktree"
case let .landMergeOverlap(paths):
let listing = paths.map { " \($0)" }.joined(separator: "\n")
return "refusing to land: \(paths.count) file\(paths.count == 1 ? "" : "s") in main worktree overlap the task branch's diff (stash or commit them, or pass --allow-dirty):\n\(listing)"
Expand Down
19 changes: 19 additions & 0 deletions Tests/VibeChardCoreTests/Domain/ErrorsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ import XCTest

final class ErrorsTests: XCTestCase {

// MARK: - land diagnostics (#124)

func testLandMainNotOnIntoMessageNamesTargetAndCurrentBranch() {
let err = VibeChardError.landMainNotOnInto(
currentBranch: "v3.1.0",
want: "main"
)
let msg = err.description

XCTAssertTrue(msg.contains("target branch is 'main'"),
"expected target branch in: \(msg)")
XCTAssertTrue(msg.contains("main worktree is currently on 'v3.1.0'"),
"expected current branch in: \(msg)")
XCTAssertTrue(msg.contains("git switch main"),
"expected direct switch hint in: \(msg)")
XCTAssertFalse(msg.contains("pass --into"),
"must not suggest --into after the target has already been resolved; got: \(msg)")
}

// MARK: - worktreeBusy (#65)

func testWorktreeBusyMessageRecommendsForceFlag() {
Expand Down