find: compare selected timestamps for -newerXY - #886
Open
SichenLiang wants to merge 1 commit into
Open
SichenLiang wants to merge 1 commit into
SichenLiang wants to merge 1 commit into
Conversation
Select the reference file's Y timestamp when building the matcher, then compare only the candidate's X timestamp. This fixes -newerXY when Y is not m and lets -anewer/-cnewer match even when the candidate's mtime is older than the reference mtime. Read reference symlinks according to -P/-H/-L: -P uses the link's time. Under -H/-L, reference paths to -newer, -anewer, and -cnewer "are dereferenced and the timestamp from the pointed-to file is used instead (if possible – otherwise the timestamp from the symbolic link is used)." GNU find manual, "Symbolic Links" section: https://www.gnu.org/software/findutils/manual/find.html A later -follow changes reference handling only for later predicates. On Windows, -newerXc now fails while parsing with "find: unsupported" and status 1 because change time is unavailable as a reference timestamp.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #886 +/- ##
==========================================
- Coverage 92.27% 92.01% -0.26%
==========================================
Files 35 35
Lines 7576 7656 +80
Branches 393 401 +8
==========================================
+ Hits 6991 7045 +54
- Misses 443 463 +20
- Partials 142 148 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
-newerXYalways used the reference mtime regardless ofY, and required both the candidate'sXandYtimestamps to be newer than it. Compare the candidate'sXtimestamp directly with the reference'sYtimestamp instead.This fixes
-anewerand-cnewerwhen the candidate's mtime is older but the selected timestamp is newer.Reference symlinks now follow the active dereference mode:
-Puses the link timestamp, while-Hand-Luse the target timestamp, or the link's own timestamp if the target does not exist. Because-followtakes effect where it appears in the expression, it changes reference handling only for later predicates. This matches the GNU find documentation.On Windows,
Y=cis rejected during parsing withfind: unsupportedand status 1 because a change time for the reference is unavailable.Fixes #885