Skip to content

Rename ResolveSameDir to ResolveSamePath and fix destination error handling#1

Closed
Claude wants to merge 4 commits intomasterfrom
claude/rename-resolve-samedir-to-resolvesamepath
Closed

Rename ResolveSameDir to ResolveSamePath and fix destination error handling#1
Claude wants to merge 4 commits intomasterfrom
claude/rename-resolve-samedir-to-resolvesamepath

Conversation

@Claude
Copy link
Copy Markdown

@Claude Claude AI commented Apr 6, 2026

The ResolveSameDir error was misleading since it's returned for both same-file and same-directory detection. Additionally, the destination stat error handler incorrectly returned SourceLocationInvalid when the destination file type was unsupported.

Changes

  • Renamed error variant: ResolveSameDirResolveSamePath across all error sites in src/file.zig, src/copy.zig, and src/main.zig

  • Added DestLocationInvalid error: New variant in ResolveError set with corresponding handler in src/main.zig that reports unsupported destination file types correctly

  • Fixed destination stat error: Changed src/file.zig:109 to return DestLocationInvalid instead of SourceLocationInvalid when destination file kind is not supported

  • Backend dispatch improvement: Replaced three sequential if checks followed by unreachable with exhaustive switch statement in src/main.zig, ensuring compiler-enforced exhaustiveness

// Before
if (options.backend == .evented) { ... }
if (options.backend == .single) { ... }
if (options.backend == .threaded) { ... }
unreachable;

// After
switch (options.backend) {
    .evented => { ... },
    .single => { ... },
    .threaded => { ... },
}

Claude AI and others added 2 commits April 6, 2026 04:57
- Renamed ResolveSameDir → ResolveSamePath for accuracy (handles both same-file and same-directory)
- Added DestLocationInvalid error variant to ResolveError set
- Fixed dest_stat error handler to return DestLocationInvalid instead of SourceLocationInvalid
- Added DestLocationInvalid handler in main.zig with appropriate error message
- Replaced three backend if blocks with exhaustive switch statement in main.zig
- All changes validated with zig build --release=fast and zig build test

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Co-authored-by: scixor <27860105+scixor@users.noreply.github.com>
- Restored FIXME comment with (¬`‸´¬) emoji
- Restored commented-out evented backend initialization code
- Kept the exhaustive switch statement structure

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Co-authored-by: scixor <27860105+scixor@users.noreply.github.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Co-authored-by: scixor <27860105+scixor@users.noreply.github.com>
@scixor scixor closed this Apr 6, 2026
@scixor scixor deleted the claude/rename-resolve-samedir-to-resolvesamepath branch April 6, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants