file conflicts: add option to rename (add suffixes) #23

Closed
opened 2025-04-09 14:58:18 +00:00 by tcsenpai · 0 comments
Owner

Originally created by @marcospb19 on 2/12/2025

Instead of asking overwrite? (y/n)

Ask overwrite? (y/n/rename)

Which accepts 'r' as the answer.

Later we can add a flag --rename (can bikeshed) to skip this question (same or different PR).

Proposed renaming behavior:

The file path/to/file.ext should be renamed to path/to/file-1.ext, but only for the file and folder paths that actually conflict (we can't detect conflicts in advance with how unpacking works right now to ensure it's applied to all files).

To clarify: if you add the suffix to folder-1, you don't need to add suffixes to files inside of that folder.

If file-1.ext already exists, bump the number and try that again, this might require multiple tries, try up to 99 and after just crash with a decent error message saying that we hit the limit and something strange is probably happening, people shouldn't rely on this behavior cause it's too wasteful and leaves tons of uncompressed archives taking space.

Prior discussion: #766.

*Originally created by @marcospb19 on 2/12/2025* Instead of asking `overwrite? (y/n)` Ask `overwrite? (y/n/rename)` Which accepts 'r' as the answer. Later we can add a flag `--rename` (can bikeshed) to skip this question (same or different PR). ### Proposed renaming behavior: The file `path/to/file.ext` should be renamed to `path/to/file-1.ext`, but only for the file and folder paths that actually conflict (we can't detect conflicts in advance with how unpacking works right now to ensure it's applied to all files). To clarify: if you add the suffix to `folder-1`, you don't need to add suffixes to files inside of that folder. If `file-1.ext` already exists, bump the number and try that again, this might require multiple tries, try up to `99` and after just crash with a decent error message saying that we hit the limit and something strange is probably happening, people shouldn't rely on this behavior cause it's too wasteful and leaves tons of uncompressed archives taking space. Prior discussion: #766.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/ouch#23
No description provided.