Skip to content

Conversation

@Xophmeister
Copy link
Member

@Xophmeister Xophmeister commented Jan 24, 2025

Optionally follow (and resolve) symlinks when specifying input files

Resolves #834

Description

Provides an -L/--follow-symlinks option to topiary format which will follow and resolve symlinks when computing the set of input files. If this CLI option is specified, then the filesystem traversal:

  • Can "break out" of the specified directories by following any directory symlinks elsewhere.
  • Will resolve symlinked files to their canonical path (skipping, if the link is broken).

The deduplication now happens after the traversal, rather than before, to dedup symlinks that point to files that exist within the input file set. (This means that if you do, say, topiary format directory directory, then it will do twice as much work before dedup'ing, but that's an edge case that's not worth worrying about.)

Checklist

Checklist before merging:

@dpulls
Copy link

dpulls bot commented Jan 24, 2025

⚠️ Dpulls not installed on repository tweag/topiary. Checkout our quickstart for how to install.

3 similar comments
@dpulls
Copy link

dpulls bot commented Jan 24, 2025

⚠️ Dpulls not installed on repository tweag/topiary. Checkout our quickstart for how to install.

@dpulls
Copy link

dpulls bot commented Jan 24, 2025

⚠️ Dpulls not installed on repository tweag/topiary. Checkout our quickstart for how to install.

@dpulls
Copy link

dpulls bot commented Jan 24, 2025

⚠️ Dpulls not installed on repository tweag/topiary. Checkout our quickstart for how to install.

Base automatically changed from chris/update-toolchain/jan2025 to main January 27, 2025 09:57
@dpulls
Copy link

dpulls bot commented Jan 27, 2025

⚠️ Dpulls not installed on repository tweag/topiary. Checkout our quickstart for how to install.

If you use `if cfg!(unix) ...` then, while the Unix branch in Windows
is unreachable, the linter still complains that Metadata.nlink isn't a
valid method.
If the traversed file is not a directory (symlinked or otherwise),
_only_ handle it if it's a regular file
Copy link
Member

@nbacquey nbacquey left a comment

Choose a reason for hiding this comment

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

LGTM except for the small remark. Thanks @Xophmeister!

@Xophmeister Xophmeister merged commit 098d0b6 into main Jan 28, 2025
10 checks passed
@Xophmeister Xophmeister deleted the chris/cli/symlinks branch January 28, 2025 11:26
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.

Topiary follows symlinks and "reifies" them, if it makes any changes

3 participants