Skip to content

fix: only-dir with duplicate top level names - #644

Open
ChandraChaan wants to merge 2 commits into
bootandy:masterfrom
ChandraChaan:fix/only-dir-dup-names
Open

ChandraChaan wants to merge 2 commits into
bootandy:masterfrom
ChandraChaan:fix/only-dir-dup-names

Conversation

@ChandraChaan

Copy link
Copy Markdown

dust -D with two inputs that have the same name prints only the total:

$ dust -D tests/test_dir_matching/dave/dup_name tests/test_dir_matching/andy/dup_name
0B ┌── (total)│█   │   0%

handle_duplicate_top_level_names renames the inputs to .../dave/dup_name(dave) and .../andy/dup_name(andy). With --only-dir, always_add_children then filters the children of (total) with c.name.is_dir(), which is false for those renamed paths since they don't exist, so both inputs are dropped.

Top level nodes (depth 0) are now not checked on disk. With a single input the root is never checked either, so this makes several inputs behave the same way. Deeper nodes are still filtered with is_dir().

Added test_handle_duplicate_names_only_dir next to test_handle_duplicate_names, using the existing tests/test_dir_matching fixtures.

I ran the CICD workflow on my fork:

When several inputs share a name, handle_duplicate_top_level_names renames
them to e.g. "dup_name(dave)". always_add_children then checked those
names with is_dir(), which is false for a path that does not exist, so
`dust -D a/dup_name b/dup_name` printed only the (total) line.

Top level nodes (depth 0) are no longer checked on disk, as with a
single input whose root is never checked.
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.

1 participant