Skip to content

fix: do not overwrite during merge - #1031

Open
valoq wants to merge 2 commits into
ouch-org:mainfrom
valoq:overwrite
Open

fix: do not overwrite during merge#1031
valoq wants to merge 2 commits into
ouch-org:mainfrom
valoq:overwrite

Conversation

@valoq

@valoq valoq commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1004

Conflicts were only resolved at the folder level. After accepting a merge, or when using --dir . or --here, each backend wrote files straight to disk and replaced same named files without asking.

Now they ask first. One shared helper in utils/fs.rs is called by tar, zip and 7z before writing a regular file, so all three behave the same: rename, overwrite or skip when prompted, overwrite with --yes, skip with --no, and no prompt when nothing clashes. Only existing files count as conflicts, so directories still merge and nothing is deleted.

Rar is left as is. Returning false from its Start callback cancels the whole extraction instead of skipping one file, and the per entry API would drop the large dictionary guard. I have not found a solution for it yet.

Added a test covering skip and overwrite for each archive format. Two old tests asserted the silent overwrite and now answer the prompt.

@valoq

valoq commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

Rar is covered as well now

should be good for review

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.

Decompression: When merging folders, files are overwritten silently

1 participant