Skip to content

create: add --no-recursion - #402

Merged
sylvestre merged 2 commits into
uutils:mainfrom
ozenyunus35:no-recursion
Oct 14, 2026
Merged

sylvestre merged 2 commits into
uutils:mainfrom
ozenyunus35:no-recursion

Conversation

@ozenyunus35

Copy link
Copy Markdown
Contributor

Closes #188

With --no-recursion, a directory named on the command line is added as a directory entry only, without its contents, like GNU tar. The entry is named dir1/, the same way append_dir_all names the top directory, and -v prints only the directory.

create_archive gets a recursive flag; the existing callers (unit tests and benches) pass true. Added test_create_no_recursion, which checks both the -v output and the archive listing.

I used an AI assistant to help draft parts of the code and tests; I reviewed the changes and ran the tests myself.

With --no-recursion, a directory named on the command line is added as a
directory entry only, without its contents, like GNU tar.

Closes uutils#188
@ozenyunus35
ozenyunus35 requested a review from kaladron as a code owner October 14, 2026 12:24
@codspeed

codspeed Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

⚠️ 4 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

✅ 7 untouched benchmarks


Comparing ozenyunus35:no-recursion (2299db6) with main (33d7f76)

Open in CodSpeed

@codecov

codecov Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.12195% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.97%. Comparing base (791ae26) to head (2299db6).
⚠️ Report is 88 commits behind head on main.

Files with missing lines Patch % Lines
src/uu/tar/src/operations/create.rs 84.61% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #402      +/-   ##
==========================================
+ Coverage   96.84%   97.97%   +1.12%     
==========================================
  Files          11       15       +4     
  Lines        1492     1827     +335     
  Branches       29       38       +9     
==========================================
+ Hits         1445     1790     +345     
+ Misses         46       36      -10     
  Partials        1        1              
Flag Coverage Δ
macos_latest 97.97% <95.12%> (+1.12%) ⬆️
ubuntu_latest 97.97% <95.12%> (+1.12%) ⬆️
windows_latest 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

Copy link
Copy Markdown

GNU Testsuite Comparison

Congrats! The gnu test tests/test 43/recurse is no longer failing!

Comment thread src/uu/tar/src/operations/create.rs Outdated

// If it's a directory, recursively add all contents
if path.is_dir() {
if path.is_dir() && !recursive {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be a single if path.is_dir() with if recursive inside, no?
would avoid calling is_dir twice

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, done.

@github-actions

Copy link
Copy Markdown

GNU Testsuite Comparison

Congrats! The gnu test tests/test 43/recurse is no longer failing!

@sylvestre
sylvestre merged commit fb55fee into uutils:main Oct 14, 2026
20 checks passed
@sylvestre

Copy link
Copy Markdown
Contributor

Thanks for your PR

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.

GNU tar compatibility: Add --no-recursion

2 participants