Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 322eda0

Browse files
committed
pass exclusionGlob to WatchedRoot
1 parent 69372b9 commit 322eda0

4 files changed

Lines changed: 20 additions & 12 deletions

File tree

src/filesystem/FileSystem.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -852,17 +852,17 @@ define(function (require, exports, module) {
852852
* @param {function(string): boolean} filter - Returns true if a particular item should
853853
* be watched, given its name (not full path). Items that are ignored are also
854854
* filtered from Directory.getContents() results within this subtree.
855-
* @param {string} nodeFilter - anymatch compatible definition for filtering out events
855+
* @param {string} globFilter - glob compatible string definition for filtering out events
856856
* on the node side.
857857
* @param {function(?string)=} callback - A function that is called when the watch has
858858
* completed. If the watch fails, the function will have a non-null FileSystemError
859859
* string parametr.
860860
*/
861-
FileSystem.prototype.watch = function (entry, filter, nodeFilter, callback) {
862-
// make nodeFilter an optional argument
863-
if (typeof nodeFilter === "function" && typeof callback !== "function") {
864-
callback = nodeFilter;
865-
nodeFilter = null;
861+
FileSystem.prototype.watch = function (entry, filter, globFilter, callback) {
862+
// make globFilter an optional argument
863+
if (typeof globFilter === "function" && typeof callback !== "function") {
864+
callback = globFilter;
865+
globFilter = null;
866866
}
867867

868868
var fullPath = entry.fullPath;
@@ -891,7 +891,7 @@ define(function (require, exports, module) {
891891
return;
892892
}
893893

894-
var watchedRoot = new WatchedRoot(entry, filter, nodeFilter);
894+
var watchedRoot = new WatchedRoot(entry, filter, globFilter);
895895

896896
this._watchedRoots[fullPath] = watchedRoot;
897897

src/filesystem/WatchedRoot.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ define(function (require, exports, module) {
3737
* @constructor
3838
* @param {File|Directory} entry
3939
* @param {function(string, string):boolean} filter
40-
* @param {string} nodeFilter
40+
* @param {string} globFilter
4141
*/
42-
function WatchedRoot(entry, filter, nodeFilter) {
42+
function WatchedRoot(entry, filter, globFilter) {
4343
this.entry = entry;
4444
this.filter = filter;
45-
this.nodeFilter = nodeFilter;
45+
this.globFilter = globFilter;
4646
}
4747

4848
// Status constants
@@ -63,7 +63,7 @@ define(function (require, exports, module) {
6363
/**
6464
* @type {string}
6565
*/
66-
WatchedRoot.prototype.nodeFilter = null;
66+
WatchedRoot.prototype.globFilter = null;
6767

6868
/**
6969
* @type {number}

src/project/ProjectManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ define(function (require, exports, module) {
738738
FileSystem.on("change", _fileSystemChange);
739739
FileSystem.on("rename", _fileSystemRename);
740740

741-
FileSystem.watch(FileSystem.getDirectoryForPath(rootPath), ProjectModel._shouldShowName, function (err) {
741+
FileSystem.watch(FileSystem.getDirectoryForPath(rootPath), ProjectModel._shouldShowName, ProjectModel.exclusionGlob, function (err) {
742742
if (err === FileSystemError.TOO_MANY_ENTRIES) {
743743
if (!_projectWarnedForTooManyFiles) {
744744
_showErrorDialog(ERR_TYPE_MAX_FILES);

src/project/ProjectModel.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ define(function (require, exports, module) {
5858
*/
5959
var _exclusionListRegEx = /\.pyc$|^\.git$|^\.gitmodules$|^\.svn$|^\.DS_Store$|^Thumbs\.db$|^\.hg$|^CVS$|^\.hgtags$|^\.idea$|^\.c9revisions$|^\.SyncArchive$|^\.SyncID$|^\.SyncIgnore$|\~$/;
6060

61+
/**
62+
* @public
63+
* Anymatch definition of files and folders that should be excluded directly
64+
* node domain watching with chokidar
65+
*/
66+
var exclusionGlob = ".git";
67+
6168
/**
6269
* @private
6370
* A string containing all invalid characters for a specific platform.
@@ -1353,6 +1360,7 @@ define(function (require, exports, module) {
13531360
exports._invalidChars = _invalidChars;
13541361

13551362
exports.shouldShow = shouldShow;
1363+
exports.exclusionGlob = exclusionGlob;
13561364
exports.isValidFilename = isValidFilename;
13571365
exports.EVENT_CHANGE = EVENT_CHANGE;
13581366
exports.EVENT_SHOULD_SELECT = EVENT_SHOULD_SELECT;

0 commit comments

Comments
 (0)