get(Hook)Files: handle globs and recurse into directories
This MR includes three changes:
- Use
getFile
ingetHookFiles
to add the contents of file hooks - Within
getFile
, first attempted a glob expansion on the specified file expression. This allows specifying e.g./lib/udev/rules.d/*.rules
. - Within
getFile
, next if the path points to a directory, add all files including those from subdirectories. This allows specifying e.g./usr/share/X11/xkb
.
The extra features of getFile
could also be leveraged to shorten some of the other code that currently calls this function. I didn't do this for now to keep the diff small for the sake of review.
The original version of the MR (which did 2. but only in getHookFiles
) is still retained in the first commit. If the approach is agreed upon, I'll squash the commits.
Merge request reports
Activity
added 1 commit
- 7a71fc5a - Use getFile for file hooks and always try to expand globs
By Johannes Marbach on 2021-12-07T20:36:47
added 1 commit
- 206b11fe - Use getFile for file hooks and always try to expand globs
By Johannes Marbach on 2021-12-07T20:49:49
added 1 commit
- e486befd - Use getFile for file hooks and always try to expand globs
By Johannes Marbach on 2021-12-10T20:23:17
- Resolved by Administrator
- Resolved by Administrator
a quick review of the changes looks good. I like your approach with trying to expand globs in getFile. I haven't had a chance to test this out yet, but would like to before merging
By clayton craft on 2021-12-12T23:38:23
added 1 commit
- 2bfcec2e - Use getFile for file hooks and always try to expand globs
By Johannes Marbach on 2021-12-14T19:36:47
added 1 commit
- c4d3bffd - get(Hook)Files: Use getFile, handle globs and dirs
By Johannes Marbach on 2021-12-14T19:48:42
- Resolved by Administrator
Can't review this because this in Go (
) but I noticed that there is a file called main_test.go with some what seems to synthetic tests. Might be good idea to add some test there to verify new behaviour of changed function(s)?By Alexey Min on 2021-12-28T04:13:38
Edited by Ghost User