Commit Graph

76 Commits

Author SHA1 Message Date
Félix Saparelli 446a8d95a7 Replace event queue with a priority queue (#302)
Solves several issues, generally through delivering signals before filesystem events, preventing situations where an overwhelming amount of events makes it impossible to quit.

Does _not_ solve the problem of a queue full of lower-priority events not accepting an urgent message, but that's a rarer issue that's more complicated to overcome.

Changes the Filterer trait: adds Priority to `check_event()`

Makes some events unfilterable (Urgent priority): SIGINT, SIGTERM, and CTRL_C to the main process. These still need to be handled by `on_action` to do anything, but cannot be stopped before reaching that.
2022-06-11 06:43:11 +00:00
Félix Saparelli 557efab1c4 Document the format of the globset tuple arguments (#298) 2022-06-07 11:46:07 +00:00
Félix Saparelli 72100217e8 Allow */foo filters to match foo (compat)
This is buggy behaviour that exists in <=1.17, and this patch restores it*

Per gitignore rules, this glob:

    */somefile

Will match:

    foo/somefile
    bar/somefile

But not:

    somefile

However, so far we’ve accepted this. As this is a breaking change, this patch
introduces a hack which lets us accept this behaviour, but clearly marks it as
a compatibility exception. In 2.0, this will be gone.

Fixes #258

* It only restores it on unices, because the behaviour cannot be restored in
  any reasonable manner on Windows. Ah well. It's not for long anyway.
2022-03-07 20:33:29 +13:00
Félix Saparelli 03aef187bd Let --exts and --filter work together
These two options are meant to work together: they are a union of filters
rather than competing. Thus:

    --exts toml,py --filter Gemfile

will match all of:

    foo.toml
    bar.py
    Gemfile

rather than matching no files at all because Gemfile doesn’t have an extension.

Fixes #259
2022-02-22 02:26:46 +13:00
Félix Saparelli b8ffa0c38a Formatting 2022-01-29 02:08:34 +13:00
Félix Saparelli c444895593
Move swaplock to the root 2022-01-28 23:32:54 +13:00
Félix Saparelli a6c997f470
globset: Always pass non-path events (#248) 2022-01-26 09:59:53 +13:00
Félix Saparelli 59d8388d7e globset: allow multipath events through if any path passes the filter 2022-01-26 01:51:48 +13:00
Félix Saparelli 42d64d0a6d
Fail all folders on extension check 2022-01-26 01:18:32 +13:00
Félix Saparelli c58333496e Fail files with no extension on extension check
Instead of passing them, I don't know what I was thinking
2022-01-18 23:56:10 +13:00
Félix Saparelli bc0fe6be70
Add context to io errors 2022-01-16 19:46:52 +13:00
Félix Saparelli 44a44a50d1
Move TaggedFiltererError into main error mod 2022-01-16 19:14:31 +13:00
Félix Saparelli 3d32f2d24b
Hook up new globset signature 2022-01-16 16:09:53 +13:00
Félix Saparelli 561a34d90e
Drop globset::list_from_ignore_file 2022-01-16 15:21:10 +13:00
Félix Saparelli b8d9ad728e
Integrate IgnoreFilterer into GlobsetFilterer 2022-01-16 15:18:15 +13:00
Félix Saparelli d6dfb87063
Integrate IgnoreFilterer into TaggedFilterer 2022-01-16 14:51:35 +13:00
Félix Saparelli 8219e577d0
Reduce swaplock hold for tagged compile globs 2022-01-16 14:51:11 +13:00
Félix Saparelli 0618eb45fc
Hold swaplock for less in change() 2022-01-16 14:48:29 +13:00
Félix Saparelli 58d47f78e1
Add more filtering logging and spans 2022-01-15 23:46:06 +13:00
Félix Saparelli 2c840f4a2d
Reorganise the ignore mod for brevity 2022-01-15 15:12:32 +13:00
Félix Saparelli 0936a68355
Split ignore mod further 2022-01-12 00:59:39 +13:00
Félix Saparelli 6a541e5f27
Move ignore_files one level deeper
in preparation for new ignore functionality
2022-01-10 20:47:06 +13:00
Félix Saparelli 26254f7022
Add support for "tagged filter files" 2021-12-24 02:20:56 +13:00
Félix Saparelli 8f9492a7bc
Fix filtering when there's both a Glob and a NotGlob match 2021-12-24 02:19:58 +13:00
Félix Saparelli f19dbf945d
Express process end exceptions as hex in filters 2021-12-23 00:32:56 +13:00
Félix Saparelli d14e7ff41b
Implement process completion signal matching 2021-12-21 18:05:52 +13:00
Félix Saparelli e4d669e230
Implement most of process completion matching
(except ExitSignal)
2021-12-21 17:56:14 +13:00
Félix Saparelli e7de00edfe
Change process completion auto op to glob 2021-12-21 17:49:24 +13:00
Félix Saparelli 4323a28852
Implement signal matching 2021-12-21 16:38:57 +13:00
Félix Saparelli 8a25ea95af
Add sig alias for signal parsed tag 2021-12-21 16:19:35 +13:00
Félix Saparelli 946c52b513
Document op and matcher mappings 2021-12-18 12:44:59 +13:00
Félix Saparelli 159a8a4b2e
Change auto op for FEKs to glob 2021-12-18 12:44:40 +13:00
Félix Saparelli ba9d9939d9
Add more aliases for matcher 2021-12-18 12:44:18 +13:00
Félix Saparelli debded9c0e
Add stability note to tagged filterer 2021-12-17 23:19:16 +13:00
Félix Saparelli d6b5dd5ae0
Test parser 2021-12-17 03:57:25 +13:00
Félix Saparelli 015447e433
Fix whitelisting in pathed globs 2021-12-15 04:57:17 +13:00
Félix Saparelli 0826d531af
Test scoped path glob filtering 2021-12-02 21:33:48 +13:00
Félix Saparelli 2d633d9177
Use proper ignore API so path globs match correctly
This notably fixes the v1 "confusing" behaviour when matching folders,
where the expectation is for any of:

folder
folder/
/folder

to match the folder and all paths below it, but v1 would only do this
when *both* of these were added:

**/folder
**/folder/**

Which is very verbose and has caught literally everyone who's ever tried
to do this kinda thing.

The old behaviour is preserved in the globset filterer, for
compatibility, as there are other small behavioural changes that this
affects, even though the new behaviour in the tagged filterer is
arguably the most correct and the old is a bug.
2021-12-01 01:41:07 +13:00
Félix Saparelli 1ff3cbf455
Add lots more logging to add_filter path 2021-11-30 02:11:50 +13:00
Félix Saparelli 269894e1b0
Add tests for tagged (paths only)
- v1 buggy tests don't pass
2021-11-28 02:22:07 +13:00
Félix Saparelli 745e3baa71
Span tracing in globset filterer check 2021-10-28 01:03:24 +13:00
Félix Saparelli 631b492064
Span tracing in tagged filterer check 2021-10-28 01:01:35 +13:00
Félix Saparelli 6671863f2f
Replace std FileType with our own (serde-able) enum 2021-10-20 01:18:43 +13:00
Félix Saparelli 34d7c5ee9c
Make globset easier to create (less generics) 2021-10-17 17:11:29 +13:00
Félix Saparelli 9d14ad7166
Document that == and != are case-insensitive 2021-10-17 04:03:18 +13:00
Félix Saparelli 489fb612c7
Tagged docs typo 2021-10-17 03:54:48 +13:00
Félix Saparelli fae4fbf9a0
Docs: error 2021-10-17 02:32:43 +13:00
Félix Saparelli 0ad0845018
Docs: filter 2021-10-16 23:14:57 +13:00
Félix Saparelli 17310ee4b5
Docs: modules 2021-10-16 17:13:32 +13:00
Félix Saparelli f58e97a62f
Fix globset ignorefile support (wrong field) 2021-10-16 17:01:27 +13:00