Skip to content

Commit

Permalink
Merge pull request #2928 from getnikola/fix-2906
Browse files Browse the repository at this point in the history
Don't refresh auto builds on files inside hidden folders
  • Loading branch information
Kwpolska committed Dec 5, 2017
2 parents 02510a8 + 16c7e50 commit 60e9861
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Expand Up @@ -27,6 +27,8 @@ Features
Bugfixes
--------

* Don't trigger rebuilds in auto mode for files it's safe to ignore
(Issue #2906)
* Fix padding for Jupyter code blocks (Issue #2927)
* Apply ``SCHEDULE_ALL`` to posts only (Issue #2921)
* Restore version number to Bootswatch URLs (Issue #2916)
Expand Down
10 changes: 5 additions & 5 deletions nikola/plugins/command/auto/__init__.py
Expand Up @@ -30,6 +30,7 @@
import datetime
import re
import os
import stat
import sys
import subprocess
import asyncio
Expand Down Expand Up @@ -273,12 +274,11 @@ def run_nikola_build(self, event):
# Move events have a dest_path, some editors like gedit use a
# move on larger save operations for write protection
event_path = event.dest_path if hasattr(event, 'dest_path') else event.src_path
fname = os.path.basename(event_path)
if (fname.endswith('~') or
fname.startswith('.') or
is_hidden = os.stat(event_path).st_file_attributes & stat.FILE_ATTRIBUTE_HIDDEN
has_hidden_component = any(p.startswith('.') for p in event_path.split(os.sep))
if (is_hidden or has_hidden_component or
'__pycache__' in event_path or
'.git' in event_path or
event_path.endswith(('.pyc', '.pyo', '.pyd', '_bak')) or
event_path.endswith(('.pyc', '.pyo', '.pyd', '_bak', '~')) or
event.is_directory): # Skip on folders, these are usually duplicates
return

Expand Down

0 comments on commit 60e9861

Please sign in to comment.