Skip to content

Suppress editing of locked files #583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix errors on commit when a file was added, never committed, then deleted from the repository (#481)
- Fixed issue with saving multiple new no-folder mapping settings at the same time (#533)
- Fixed sending OS error when git pull encounters error (#545)
- Fixed suppressing editing of locked classes (#301)

## [2.6.0] - 2024-10-07

Expand Down
9 changes: 7 additions & 2 deletions cls/SourceControl/Git/Extension.cls
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,18 @@ Method UserAction(Type As %Integer, Name As %String, InternalName As %String, Se
// if item is being edited in a different namespace, opening it will display an alert. Editing in this namespace will remove the alert.
set filename = ##class(SourceControl.Git.Utils).FullExternalName(.InternalName)
do ##class(SourceControl.Git.Change).GetUncommitted(filename,.tAction)
do ..GetStatus(.InternalName, .isInSourceControl, .isEditable,.isCheckedOut,.userCheckedOut)
if '$data(tAction) {
set user = "", inNamespace = ""
if ##class(SourceControl.Git.Utils).InstanceWideUncommittedCheck(InternalName, .user, .inNamespace) {
if 'isEditable || ##class(SourceControl.Git.Utils).Locked() {
set Target = "Warning: Attempting to edit read-only file"
write !, Target
set Action = 6
} elseif ##class(SourceControl.Git.Utils).InstanceWideUncommittedCheck(InternalName, .user, .inNamespace) {
set Target = "Warning: Item " _ InternalName _ " is currently being modified by " _ user _ " in namespace " _ inNamespace _ "."
write !, Target
set Action = 6
}
}
}
}
}
Expand Down
Loading