mirror of
https://github.com/textmate/textmate.git
synced 2026-01-23 05:37:55 -05:00
Disable SCM badges for non-local paths
Also disable it for user’s home folder and root of file system — having to monitor these folders is too expensive.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <io/path.h>
|
||||
#include <text/format.h>
|
||||
#include <plist/date.h>
|
||||
#include <settings/settings.h>
|
||||
|
||||
namespace scm
|
||||
{
|
||||
@@ -283,6 +284,11 @@ namespace scm { namespace ng
|
||||
return shared_info_ptr();
|
||||
}
|
||||
|
||||
static bool scm_enabled_for_path (std::string const& path)
|
||||
{
|
||||
return path != "" && path != "/" && path[0] == '/' && path != path::home() && path::is_local(path) && settings_for_path(NULL_STR, "", path).get(kSettingsSCMStatusKey, true);
|
||||
}
|
||||
|
||||
void disable ()
|
||||
{
|
||||
Disabled = true;
|
||||
@@ -301,7 +307,7 @@ namespace scm { namespace ng
|
||||
|
||||
std::string root_for_path (std::string const& path)
|
||||
{
|
||||
if(path == NULL_STR || path == "" || path[0] != '/')
|
||||
if(!scm_enabled_for_path(path))
|
||||
return NULL_STR;
|
||||
|
||||
__block std::string res = NULL_STR;
|
||||
@@ -331,7 +337,7 @@ namespace scm { namespace ng
|
||||
|
||||
info_ptr info (std::string path)
|
||||
{
|
||||
if(path == NULL_STR || path == "" || path[0] != '/')
|
||||
if(!scm_enabled_for_path(path))
|
||||
return info_ptr();
|
||||
|
||||
info_ptr res(new info_t(path));
|
||||
|
||||
Reference in New Issue
Block a user