2
10
Fork
You've already forked duplik
1

Exclude hidden files by default and add option to include #7

Merged
hgrsd merged 7 commits from exclude-hidden into main 2026年06月06日 10:30:10 +02:00
Owner
Copy link

Someone wanting to detect duplicates is often not interested in hidden files; they are often noise, build artifacts, etc. I think a sane default is to exclude hidden files, which is what this PR does. It also adds an option to include them (with -H or --include-hidden).

Another small change I've made is to pass the Args struct around wherever it is needed instead of passing all options as individual function arguments, because the function signatures were getting unwieldy. We probably want to change the Args struct to bundle detection config (include hidden, max depth, excluded directories, number of workers) from other concerns (raw root path, use absolute path). I might do this in a follow up.

Someone wanting to detect duplicates is often not interested in hidden files; they are often noise, build artifacts, etc. I think a sane default is to exclude hidden files, which is what this PR does. It also adds an option to include them (with -H or --include-hidden). Another small change I've made is to pass the Args struct around wherever it is needed instead of passing all options as individual function arguments, because the function signatures were getting unwieldy. We probably want to change the Args struct to bundle detection config (include hidden, max depth, excluded directories, number of workers) from other concerns (raw root path, use absolute path). I might do this in a follow up.
update readme
Some checks failed
Continuous Integration / build (pull_request) Has been cancelled
44a8f5adf2
add TODO
Some checks failed
Continuous Integration / build (pull_request) Has been cancelled
422989ed25
fmt
All checks were successful
Continuous Integration / build (pull_request) Successful in 1m38s
dc0dfb770d
fix readme formatting
All checks were successful
Continuous Integration / build (pull_request) Successful in 50s
2a4ed8a2fb
@ -87,0 +89,4 @@
/// including hidden files if the user wants to,computing their sizes by stat-ing them. Only files
/// that have the same file size as another file are potential duplicates and will be returned from
/// this function. This is a cheap first-pass filter to rule out non-duplicates without reading their bytes.
fnfilterUniqueSizes(arena:std.mem.Allocator,io:std.Io,root:std.Io.Dir,args:Args)![]constPotentialDuplicate{
Contributor
Copy link

maybe instead of passing the whole args, a custom struct with the parameters only needed by this function?

maybe instead of passing the whole args, a custom struct with the parameters only needed by this function?
@ -206,3 +215,2 @@
/// with a single reader that collects the hashed files and finds the duplicates.
fndetectDuplicates(arena:std.mem.Allocator,io:std.Io,root:std.Io.Dir,max_depth:usize,exclude_dirs:std.ArrayList([]constu8),n_workers:usize)!Duplicates{
constpotential_duplicates=tryfilterUniqueSizes(arena,io,root,max_depth,exclude_dirs);
fndetectDuplicates(arena:std.mem.Allocator,io:std.Io,root:std.Io.Dir,args:Args)!Duplicates{
Contributor
Copy link

same comment as above

same comment as above
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hgrsd/duplik!7
Reference in a new issue
hgrsd/duplik
No description provided.
Delete branch "exclude-hidden"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?