Skip to content

Commit

Permalink
explicitly ignore '.git' folder on Windows
Browse files Browse the repository at this point in the history
Resolves #2141.
  • Loading branch information
kevinushey authored and jmcphers committed Mar 27, 2018
1 parent bc4831c commit 1ccc001
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/cpp/core/system/file_monitor/Win32FileMonitor.cpp
Expand Up @@ -19,6 +19,7 @@

#include <memory>

#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/algorithm/string/classification.hpp>

Expand Down Expand Up @@ -488,6 +489,20 @@ Error readDirectoryChanges(FileEventContext* pContext)
}
}

bool gitFilter(const FileInfo& fileInfo,
const boost::function<bool(const FileInfo&)>& filter)
{
// screen out '.git' folder
if (fileInfo.isDirectory() &&
boost::algorithm::ends_with(fileInfo.absolutePath(), ".git"))
{
return false;
}

// delegate to registered filter
return filter(fileInfo);
}

} // anonymous namespace

namespace detail {
Expand Down Expand Up @@ -555,7 +570,7 @@ Handle registerMonitor(const core::FilePath& filePath,
core::system::FileScannerOptions options;
options.recursive = recursive;
options.yield = true;
options.filter = filter;
options.filter = boost::bind(gitFilter, _1, filter);
error = scanFiles(FileInfo(filePath), options, &pContext->fileTree);
if (error)
{
Expand Down

0 comments on commit 1ccc001

Please sign in to comment.