lib.fileset.union, lib.fileset.unions: init#255025
Conversation
We can now test returned paths being equal, no need to work around it anymore by making sure paths aren't returned (which would import them with the previous --json)
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
roberth
left a comment
There was a problem hiding this comment.
Minor things and a concern about stack overflows when thunks build up in a lazy part despite foldl' (might be due to incomplete understanding of filesets, but test would be appreciated)
|
@roberth @fricklerhandwerk Thanks! I applied the suggestions Good catch on the stack overflow potential @roberth, indeed it does stack overflow with many files! I fixed that now and included a test case with I also added a benchmark for I also opened two nixdoc issues: |
4e9e8c3 to
622cdf4
Compare
|
I'm fairly happy with this now, do you want to take a closer look @roberth? |
roberth
left a comment
There was a problem hiding this comment.
Two suggestions, but lgtm now!
lib/fileset/default.nix
Outdated
There was a problem hiding this comment.
These bindings are only used once. Are you sure the earlier renaming is necessary?
There was a problem hiding this comment.
Not necessary yeah, though just passing the argument between functions directly was a bit unsightly, so I'm using lib.pipe instead now: https://github.com/NixOS/nixpkgs/compare/622cdf4567bc0e98a0926df7ea8ffedf89d94298..1498af4bf1ab058053ff35a4f601e02859420828
There was a problem hiding this comment.
I can never remember the order of pipe, probably because I dislike it.
Whatever works, I guess.
lib/fileset/default.nix
Outdated
There was a problem hiding this comment.
| # TODO: This could be supported, but requires an extra internal representation for the empty file set | |
| # TODO: This could be supported, but requires an extra internal representation for the empty file set, which would be special for not having a root. |
There was a problem hiding this comment.
Did s/root/base path, since that's the term used throughout
622cdf4 to
1498af4
Compare
Also some minor formatting improvements
Previously a lot of processes were used, slowing it down considerably the more files were tested
$ ./benchmark.sh HEAD
[...]
Mean CPU time 0.04006 (σ = 0.0040146) for 10 runs is 8.193619775953792% (σ = 0.9584251052704821%) of the old value 0.488917 (σ = 0.0294955)
[...]
Co-authored-by: Robert Hensing <[email protected]> Co-authored-by: Valentin Gagarin <[email protected]>
1498af4 to
94e103e
Compare
|
Very minor push to add a level of indentation to doc comments (diff) Thanks for the review Robert, I'll merge this when I see it next time with CI passing! |
Description of changes
This is another split off from the file set combinators PR, based on top of the already-merged
lib.fileset.toSourceand fileset infrastructure.This adds two new functions, allowing the creation of unions of file sets:
Comparatively, doing this correctly using the existing
lib.sourcesfunctions is notoriously difficult.This work is sponsored by Antithesis ✨
Things done