guard / listen

The Listen gem listens to file modifications and notifies you about the changes.
https://rubygems.org/gems/listen
MIT License
1.92k stars 246 forks source link

Ignore mutagen sync temporary files #469

Closed nilbus closed 4 years ago

nilbus commented 4 years ago

Mutagen is a sync tool for remote development that copies files into place on a remote machine [running listen/guard] when edits are made on a local machine. To perform an atomic update, it creates a temp/staging file and moves it into place.

Normally this results in an addition, which results in the change being ignored by many guard plugins. Listen's QueueOptimizer can detect this as an "editor save" when it detects that a silenced temp file is moved to replace a watched file.

This patch updates the ignore pattern to detect mutagen temp files, silencing them and allowing the staging file move to be detected properly as a modification.

Post-merge tasks

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.04%) to 97.843% when pulling bae2631186f9bb2dc5bccbe30ece8b104ffcb46e on nilbus:mutagen into 896c74c83bdba0d1698af3828a14b28d813cad7c on guard:master.

nilbus commented 4 years ago

Mutagen creates all its files with a .mutagen-temporary prefix (reference). I put the prefix pattern ending in .* in the suffixes where all other tempfile patterns are. Matching will be as performant as the others, but let me know if you think it should go into its own separate ignore prefixes list since it's not technically a suffix.

benjaminoakes commented 4 years ago

Thank you for addressing this

rymai commented 4 years ago

@nilbus Thank you, looks good to me! :heart: :yellow_heart: :green_heart: :rocket: