Skip to content

fix: resolve symlinks in tree root #572

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jacobkoziej
Copy link

The following resolves symlinks in the tree root path to avoid false-positives where paths (with symlinks) specified inside the tree root are marked outside.

@jacobkoziej
Copy link
Author

Looks like TestTreeRoot fails with this change (which is to be expected). I think the reasonable course of action is to re-write the test so that temporary directories that exist on disk get used. I'd offer to do this, but I'm not familiar enough with golang or the testing framework treefmt uses :(

@jacobkoziej jacobkoziej force-pushed the fix/resolve-symlinks-in-tree-root branch from 6355cea to e092662 Compare April 11, 2025 21:46
@brianmcgee brianmcgee requested review from jfly and brianmcgee April 12, 2025 06:36
Copy link
Collaborator

@jfly jfly left a comment

Choose a reason for hiding this comment

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

Thanks, @jacobkoziej!

I think the reasonable course of action is to re-write the test so that temporary directories that exist on disk get used.

That sounds reasonable to me. See this test for an example of how to create a temp dir for a test:

tempDir := t.TempDir()

We should also make sure the user experience is OK when a non-existent directory is specified.

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.

2 participants