diff --git a/Frameworks/DocumentWindow/src/DocumentController.mm b/Frameworks/DocumentWindow/src/DocumentController.mm index 3c6f421f..2f3a4fa0 100644 --- a/Frameworks/DocumentWindow/src/DocumentController.mm +++ b/Frameworks/DocumentWindow/src/DocumentController.mm @@ -901,15 +901,7 @@ namespace if(doc->path() == NULL_STR) { if(scm::info_ptr info = scm::info(docDirectory)) - { - std::string const& branch = info->branch(); - if(branch != NULL_STR) - map["TM_SCM_BRANCH"] = branch; - - std::string const& name = info->scm_name(); - if(name != NULL_STR) - map["TM_SCM_NAME"] = name; - } + map = info->variables(); } if(NSString* projectPath = self.defaultProjectPath ?: self.fileBrowser.path ?: [NSString stringWithCxxString:path::parent(doc->path())]) diff --git a/Frameworks/document/src/document.cc b/Frameworks/document/src/document.cc index ed1dbcfc..6b586277 100644 --- a/Frameworks/document/src/document.cc +++ b/Frameworks/document/src/document.cc @@ -498,13 +498,8 @@ namespace document if(scm::info_ptr info = scm::info(path::parent(path()))) { - std::string const& branch = info->branch(); - if(branch != NULL_STR) - map["TM_SCM_BRANCH"] = branch; - - std::string const& name = info->scm_name(); - if(name != NULL_STR) - map["TM_SCM_NAME"] = name; + for(auto pair : info->variables()) + map.insert(pair); } } diff --git a/Frameworks/file/src/path_info.cc b/Frameworks/file/src/path_info.cc index 1467b061..a3522097 100644 --- a/Frameworks/file/src/path_info.cc +++ b/Frameworks/file/src/path_info.cc @@ -97,9 +97,9 @@ namespace { if(scm::info_ptr info = scm::info(dir)) { - std::string const branch = info->branch(); - if(branch != NULL_STR) - res.push_back("attr.scm.branch." + branch); + auto scmVariables = info->variables(); + if(scmVariables.find("TM_SCM_BRANCH") != scmVariables.end()) + res.push_back("attr.scm.branch." + scmVariables["TM_SCM_BRANCH"]); if(path != NULL_STR) { @@ -158,25 +158,16 @@ namespace file std::map variables (std::string const& path) { std::map map; - // map["TM_DOCUMENT_UUID"] = to_s(identifier()); if(path != NULL_STR) { + if(scm::info_ptr info = scm::info(path::parent(path))) + map = info->variables(); + map["TM_DISPLAYNAME"] = path::display_name(path); map["TM_FILEPATH"] = path; map["TM_FILENAME"] = path::name(path); map["TM_DIRECTORY"] = path::parent(path); map["PWD"] = path::parent(path); - - if(scm::info_ptr info = scm::info(path::parent(path))) - { - std::string const& branch = info->branch(); - if(branch != NULL_STR) - map["TM_SCM_BRANCH"] = branch; - - std::string const& name = info->scm_name(); - if(name != NULL_STR) - map["TM_SCM_NAME"] = name; - } } else {