Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove automatic detection for partial compression #286

Merged
merged 2 commits into from
Oct 14, 2022

Conversation

marcospb19
Copy link
Member

@marcospb19 marcospb19 commented Oct 13, 2022

Fixes #285 and fixes #282 with a feature regression.

What is the problem this feature used to solve?

Ouch infers compression formats from file extensions.

ouch compress file file.tar.gz

From the output file, Ouch infers the formats [Tar, Gz].


However, sometimes you want to compress a file that is already compressed, for example:

ouch compress file.tar file.tar.gz

Again, Ouch infers the formats [Tar, Gz] and compresses file.tar with these formats in mind, this is a problem because the end result is an archive of type [Tar, Tar, Gz].

Ouch should, in some way, enable the user to compress this just using [Gz] (I'm calling this partial compression, because the archive is already partially compressed).

The feature

I implemented (with the code removed by this PR) a tiny automatic detection for when formats match.

Problems with automatic detection:

  1. Current implementation is flawed (thanks to me, a lot of false-positives and format mismatchs).
  2. It's counter-intuitive and unpredictable behavior (especially for first-timers).
  3. Users don't notice when it happens because we already log so much.
  4. Does not work with stdout and stdin, because those aren't named.
  5. Cannot force partial compression without renaming files manually.

Solution

Regress this feature and implement --format flag.

@marcospb19 marcospb19 changed the title Remove partial (de)compression feature Remove automatic detections for partial (de)compression feature Oct 13, 2022
@marcospb19 marcospb19 changed the title Remove automatic detections for partial (de)compression feature Remove automatic detection for partial compression Oct 13, 2022
@marcospb19 marcospb19 force-pushed the remove-partial-compression-and-decompression-feature branch from 48dc0d5 to b68a8de Compare October 13, 2022 21:53
@marcospb19 marcospb19 force-pushed the remove-partial-compression-and-decompression-feature branch from b68a8de to 2cb75a9 Compare October 13, 2022 21:53
@marcospb19 marcospb19 marked this pull request as ready for review October 13, 2022 22:22
@figsoda figsoda merged commit bda6c27 into main Oct 14, 2022
@figsoda figsoda deleted the remove-partial-compression-and-decompression-feature branch October 14, 2022 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants