diff --git a/src/branches.cpp b/src/branches.cpp index 083709b2..a6118d20 100644 --- a/src/branches.cpp +++ b/src/branches.cpp @@ -194,8 +194,19 @@ namespace l paths.push_back(glob); fs::realpathize(&paths); - for(auto &path : paths) + for(const auto &path : paths) { + bool is_dir; + std::error_code ec; + + is_dir = ghc::filesystem::is_directory(path,ec); + if(!ec && !is_dir) + { + syslog_notice("branch path '%s' is not a directory, ignoring", + path.c_str()); + continue; + } + branch.path = path; branches_->push_back(branch); } diff --git a/src/branches.hpp b/src/branches.hpp index a8ef781a..a13d4803 100644 --- a/src/branches.hpp +++ b/src/branches.hpp @@ -76,6 +76,8 @@ public: operator CPtr() const { std::lock_guard lg(_mutex); return _impl; } CPtr operator->() const { std::lock_guard lg(_mutex); return _impl; } + Ptr operator->() { std::lock_guard lg(_mutex); return _impl; } + public: void find_and_set_mode_ro();