diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..a57a8a72 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,15 @@ +# git-source-control + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [2.0.2] - 2022-08-09 + +### Fixed +- #201: fix behavior with CSP files + +## [2.0.1] - 2022-06-02 +- Last released version before CHANGELOG existed. + diff --git a/README.md b/README.md index 40b570e8..69566dfb 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,16 @@ The same right click menus as in Studio live under "Server Source Control..." wh ## Notes +### Mapping Configuration +To specify where files should go relative to your repository root, add mappings via the "Settings" menu item. A mapping has three parts: +* The file extension to use: e.g., CLS, MAC. As a special case for web application files, use "/CSP/" as the mapping. +* A filter on the files of that type (e.g., a package name or web application folder) +* The folder relative to the repo root that contains the item. This controls behavior for import and export. + +This might look like: + +![Example of mapping configuration](docs/images/settings.PNG "Example of mapping configuration") + ### Security If you want to interact with remotes from VSCode/Studio directly (e.g., to push/pull), you must use ssh (rather than https), create a public/private key pair to identify the instance (not yourself), configure the private key file for use in Settings, and configure the public key as a deploy key in the remote(s). diff --git a/cls/SourceControl/Git/Utils.cls b/cls/SourceControl/Git/Utils.cls index 442f79fd..f3538562 100644 --- a/cls/SourceControl/Git/Utils.cls +++ b/cls/SourceControl/Git/Utils.cls @@ -450,8 +450,11 @@ ClassMethod AddToSourceControl(InternalName As %String) As %Status if 'sc { set ec = $$$ADDSC(ec, sc) } - for i=1:1:filenames{ + for i=1:1:$Get(filenames) { set FileInternalName = ##class(SourceControl.Git.Utils).NormalizeExtension(##class(SourceControl.Git.Utils).NameToInternalName(filenames(i), 0,,1)) + if (FileInternalName = "") { + continue + } set FileType = ##class(SourceControl.Git.Utils).Type(FileInternalName) set @..#Storage@("items", FileInternalName) = "" @@ -1566,22 +1569,28 @@ ClassMethod NameToInternalName(Name, IgnorePercent = 1, IgnoreNonexistent = 1, V set currScore = 0 while (queryary'="")&&(mappingsSubscript="mappings") { set nam = $extract(name, $length(dir)+1, *) - if ($zconvert(subscript, "U") = $zconvert($piece(name, ".", *), "U")){ + if ($zconvert(subscript, "U") = $zconvert($piece(name, ".", *), "U")) { + set extScore = 1 + } elseif (subscript = "/CSP/") { set extScore = 1 } else { set extScore = 0 } - if ((dir["/")&&(dir=$extract(name, 1, $length(dir)))){ + if ((dir["/")&&(dir=$extract(name, 1, $length(dir)))) { set pathScore = 1 } else { set pathScore = 0 } - if (coverage = "*"){ + if (coverage = "*") { set covScore = 1 } elseif ($extract($translate(nam, "/", "."), 1, ($length(coverage)+1)) = (coverage_".")) { set covScore = 2 + } elseif (subscript = "/CSP/") { + // Normalize coverage to start/end with slash + set coverage = $case($extract(coverage),"/":"",:"/")_coverage_$case($extract(coverage,*),"/":"",:"/") + set covScore = pathScore } else { set covScore = 0 } diff --git a/csp/gitprojectsettings.csp b/csp/gitprojectsettings.csp index 715670ac..f26b44e0 100644 --- a/csp/gitprojectsettings.csp +++ b/csp/gitprojectsettings.csp @@ -160,8 +160,12 @@ body {
- Set fileExists=##class(%File).Exists(settings.privateKeyFile) - if (fileExists) { + Set fileExists = ##class(%File).Exists(settings.privateKeyFile) + if (settings.privateKeyFile = "") { + set class = "form-control" + set divClass = "neutral-feedback" + set feedbackText = "You must configure an SSH private key to be able to work with remotes. This should be set up as a deploy key / equivalent, authenticating the server, not a specific user." + } elseif (fileExists) { set class = "form-control is-valid" set divClass = "" set feedbackText = "" @@ -200,7 +204,7 @@ body {
- +