Repository navigation
Conversation
…ectory `oxen checkout <branch>` deleted any file sitting where the target branch has a directory, unless it was a tracked file with local edits. An untracked file there, or a file put in place of a tracked directory, was lost with no error, while the same untracked file stopped the checkout when the target had a file at that path instead. Checkout now replaces such a file only when it is the current commit's file at that path, unchanged, and otherwise fails with the "your local changes would be overwritten" error and leaves the working tree as it was. `oxen merge --abort` still replaces it. This affects local working trees only (the CLI and Python bindings), not oxen-server. Fixes #1136
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Directory replacement conflict handling crates/liboxen/src/core/v_latest/branches.rs, crates/liboxen/src/repositories/checkout.rs |
Under OnConflict::Abort, checkout records a conflict if no corresponding from-tree file exists or if the tracked file fails the size and mtime-or-hash checks. Tests verify refusal and content preservation, permitted replacement of an unchanged tracked file, and replacement under OnConflict::Overwrite. |
Estimated code review effort: 2 (Simple) | ~12 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related issues
Merge Risk: 
Minimal · up to 73e29
-
Checkout appears to preserve conflicting local files while still allowing an unchanged tracked file to be replaced. No actionable merge risk remains after normal checks.
Pre-merge checks: 
4
-
Full details: Linked Issues check
-
Explanation
Issue [
#1136] requires checkout to refuse a non-directory entry where the target tree requires a directory, report the local-changes-overwritten error, and preserve the entry.walk_target_treenow permits replacement underOnConflict::Abortonly for an unchanged file from the current tree. Untracked entries and changed tracked entries become conflicts before any replacement. The regression test covers an untracked file, error text, unchanged contents, and unchanged HEAD. The test also covers replacement of an unchanged tracked file and the existing overwrite path.
Full details: Out of Scope Changes check
-
Explanation
The changes are limited to checkout conflict handling in
crates/liboxen/src/core/v_latest/branches.rsand related checkout regression tests. TheOnConflict::Overwriteassertion verifies the documentedoxen merge --abortbehavior. The changes support the linked checkout objective and do not add unrelated product behavior.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
oxen checkout <branch>deleted any file sitting where the target branch has a directory, unless it was a tracked file with local edits. An untracked file there, or a file put in place of a tracked directory, was lost with no error, while the same untracked file stopped the checkout when the target had a file at that path instead.Checkout now replaces such a file only when it is the current commit's file at that path, unchanged, and otherwise fails with the "your local changes would be overwritten" error and leaves the working tree as it was.
oxen merge --abortstill replaces it. This affects local working trees only (the CLI and Python bindings), not oxen-server.Fixes #1136