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

Fix touch to allow changing timestamps on directories, remake from #11760 #12005

Merged
merged 5 commits into from Mar 1, 2024

Conversation

kik4444
Copy link
Contributor

@kik4444 kik4444 commented Feb 28, 2024

Based off of #11760 to be mergable without conflicts.

Description

Fix for #11757.
The main issue in #11757 is I tried to copy the timestamp from one directory to another only to realize that did not work whereas the coreutils ^touch had no problems. I thought --reference just did not work, but apparently the whole touch command could not work on directories because OpenOptions::new().write(true).create(true).open(&item) tries to create touch's target in advance and then modify its timestamps. But if the target is a directory that already exists then this would fail even though the crate used for working with timestamps, filetime, already works on directories.

User-Facing Changes

I don't believe this should change any existing valid behaviors. It just changes a non-working behavior.

Tests + Formatting

I only could not run cargo test because I get compilation errors on the latest main branch
All tests pass with cargo test --features=sqlite

After Submitting

@fdncred
Copy link
Collaborator

fdncred commented Mar 1, 2024

Thanks!

@fdncred fdncred merged commit 38a4290 into nushell:main Mar 1, 2024
19 checks passed
@hustcer hustcer added this to the v0.91.0 milestone Mar 1, 2024
@kik4444 kik4444 deleted the touch-refactor branch April 25, 2024 12:27
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.

None yet

4 participants