Skip to content

Commit a26e2d7

Browse files
authored
Merge pull request #583 from intersystems/issue-301
Suppress editing of locked files
2 parents 3732250 + 5a78a6d commit a26e2d7

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4545
- Fix errors on commit when a file was added, never committed, then deleted from the repository (#481)
4646
- Fixed issue with saving multiple new no-folder mapping settings at the same time (#533)
4747
- Fixed sending OS error when git pull encounters error (#545)
48+
- Fixed suppressing editing of locked classes (#301)
4849

4950
## [2.6.0] - 2024-10-07
5051

cls/SourceControl/Git/Extension.cls

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,18 @@ Method UserAction(Type As %Integer, Name As %String, InternalName As %String, Se
5959
// if item is being edited in a different namespace, opening it will display an alert. Editing in this namespace will remove the alert.
6060
set filename = ##class(SourceControl.Git.Utils).FullExternalName(.InternalName)
6161
do ##class(SourceControl.Git.Change).GetUncommitted(filename,.tAction)
62+
do ..GetStatus(.InternalName, .isInSourceControl, .isEditable,.isCheckedOut,.userCheckedOut)
6263
if '$data(tAction) {
6364
set user = "", inNamespace = ""
64-
if ##class(SourceControl.Git.Utils).InstanceWideUncommittedCheck(InternalName, .user, .inNamespace) {
65+
if 'isEditable || ##class(SourceControl.Git.Utils).Locked() {
66+
set Target = "Warning: Attempting to edit read-only file"
67+
write !, Target
68+
set Action = 6
69+
} elseif ##class(SourceControl.Git.Utils).InstanceWideUncommittedCheck(InternalName, .user, .inNamespace) {
6570
set Target = "Warning: Item " _ InternalName _ " is currently being modified by " _ user _ " in namespace " _ inNamespace _ "."
6671
write !, Target
6772
set Action = 6
68-
}
73+
}
6974
}
7075
}
7176
}

0 commit comments

Comments
 (0)