From 3d529a2f0d381fecadddf6c1153ad645890068fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20D=C3=B6rbandt?= Date: Thu, 31 Oct 2024 17:56:00 +0100 Subject: [PATCH] Only store custom terminal commands in preference Storing automatically detected terminal commands causes problems when knownTerminalCommands is updated, because an old command may still be stored. --- .../instance/detectTerminalCommand.st | 5 +---- .../instance/requestTerminalCommand.st | 9 +++++++++ .../instance/terminalCommand.st | 12 +----------- .../methodProperties.json | 5 +++-- .../customTerminalCommandForExternalCommands..st | 3 +++ ...t => customTerminalCommandForExternalCommands.st} | 4 ++-- .../class/terminalCommandForExternalCommands..st | 3 --- .../GitFeatureFlags.class/methodProperties.json | 4 ++-- .../GitFeatureFlags.class/properties.json | 2 +- 9 files changed, 22 insertions(+), 25 deletions(-) create mode 100644 src/FileSystem-Git.package/FileSystemGitRepository.class/instance/requestTerminalCommand.st create mode 100644 src/FileSystem-Git.package/GitFeatureFlags.class/class/customTerminalCommandForExternalCommands..st rename src/FileSystem-Git.package/GitFeatureFlags.class/class/{terminalCommandForExternalCommands.st => customTerminalCommandForExternalCommands.st} (87%) delete mode 100644 src/FileSystem-Git.package/GitFeatureFlags.class/class/terminalCommandForExternalCommands..st diff --git a/src/FileSystem-Git.package/FileSystemGitRepository.class/instance/detectTerminalCommand.st b/src/FileSystem-Git.package/FileSystemGitRepository.class/instance/detectTerminalCommand.st index 3e8c201d1..3a4a6a86b 100644 --- a/src/FileSystem-Git.package/FileSystemGitRepository.class/instance/detectTerminalCommand.st +++ b/src/FileSystem-Git.package/FileSystemGitRepository.class/instance/detectTerminalCommand.st @@ -2,7 +2,4 @@ git porcelain - external detectTerminalCommand ^ self knownTerminalCommands detect: [:each | self commandExists: each] - ifNone: [UIManager request: - 'No terminal emulator could be detected. ', - 'Please provide a command to spawn a terminal emulator. ', - (Preferences pragmaPreferenceFor: GitFeatureFlags getter: #terminalCommandForExternalCommands) helpString] \ No newline at end of file + ifNone: [self requestTerminalCommand] \ No newline at end of file diff --git a/src/FileSystem-Git.package/FileSystemGitRepository.class/instance/requestTerminalCommand.st b/src/FileSystem-Git.package/FileSystemGitRepository.class/instance/requestTerminalCommand.st new file mode 100644 index 000000000..a96aebaab --- /dev/null +++ b/src/FileSystem-Git.package/FileSystemGitRepository.class/instance/requestTerminalCommand.st @@ -0,0 +1,9 @@ +git porcelain - external +requestTerminalCommand + | command | + command := UIManager request: + 'No terminal emulator could be detected. ', + 'Please provide a command to spawn a terminal emulator. ', + (Preferences pragmaPreferenceFor: GitFeatureFlags getter: #customTerminalCommandForExternalCommands) helpString. + GitFeatureFlags customTerminalCommandForExternalCommands: command. + ^ command \ No newline at end of file diff --git a/src/FileSystem-Git.package/FileSystemGitRepository.class/instance/terminalCommand.st b/src/FileSystem-Git.package/FileSystemGitRepository.class/instance/terminalCommand.st index 3400bc892..9a1181ba7 100644 --- a/src/FileSystem-Git.package/FileSystemGitRepository.class/instance/terminalCommand.st +++ b/src/FileSystem-Git.package/FileSystemGitRepository.class/instance/terminalCommand.st @@ -1,13 +1,3 @@ git porcelain - external terminalCommand - ^ GitFeatureFlags terminalCommandForExternalCommands - ifNotEmpty: [:command | - (self commandExists: command) - ifTrue: [command] - ifFalse: [ - GitFeatureFlags terminalCommandForExternalCommands: ''. - self terminalCommand]] - ifEmpty: [ | command | - command := self detectTerminalCommand. - GitFeatureFlags terminalCommandForExternalCommands: command. - command] \ No newline at end of file + ^ GitFeatureFlags customTerminalCommandForExternalCommands ifEmpty: [self detectTerminalCommand] \ No newline at end of file diff --git a/src/FileSystem-Git.package/FileSystemGitRepository.class/methodProperties.json b/src/FileSystem-Git.package/FileSystemGitRepository.class/methodProperties.json index 55410ea96..d78248753 100644 --- a/src/FileSystem-Git.package/FileSystemGitRepository.class/methodProperties.json +++ b/src/FileSystem-Git.package/FileSystemGitRepository.class/methodProperties.json @@ -12,7 +12,7 @@ "commandExists:" : "mad 4/3/2024 15:10", "commitNamed:" : "jr 8/13/2020 23:08", "createBranchNamed:at:" : "jr 3/4/2020 00:47", - "detectTerminalCommand" : "mad 4/3/2024 15:10", + "detectTerminalCommand" : "mad 10/31/2024 17:49", "expandRemoteRef:" : "pre 6/15/2018 16:04", "externalCommand:" : "mad 5/22/2024 13:55", "externalGitDo:" : "mad 5/22/2024 13:29", @@ -46,10 +46,11 @@ "remoteUrl:" : "jr 3/4/2020 00:46", "removeRemoteNamed:" : "jr 3/4/2020 00:49", "repository" : "CamilloBruni 6/22/2011 05:08", + "requestTerminalCommand" : "mad 10/31/2024 17:50", "tagNamed:" : "MCGitRepositoryTest 3/3/2020 23:40", "tagNames" : "MCGitRepositoryTest 3/3/2020 23:42", "tags" : "jr 3/4/2020 00:49", - "terminalCommand" : "mad 12/22/2023 17:34", + "terminalCommand" : "mad 10/31/2024 17:51", "terminalCommand:" : "mad 4/3/2024 16:00", "unitOfWork" : "jr 4/10/2020 10:08", "updateBranchNamed:to:" : "jr 3/4/2020 00:50", diff --git a/src/FileSystem-Git.package/GitFeatureFlags.class/class/customTerminalCommandForExternalCommands..st b/src/FileSystem-Git.package/GitFeatureFlags.class/class/customTerminalCommandForExternalCommands..st new file mode 100644 index 000000000..5000e1b63 --- /dev/null +++ b/src/FileSystem-Git.package/GitFeatureFlags.class/class/customTerminalCommandForExternalCommands..st @@ -0,0 +1,3 @@ +accessing +customTerminalCommandForExternalCommands: aString + CustomTerminalCommandForExternalCommands := aString \ No newline at end of file diff --git a/src/FileSystem-Git.package/GitFeatureFlags.class/class/terminalCommandForExternalCommands.st b/src/FileSystem-Git.package/GitFeatureFlags.class/class/customTerminalCommandForExternalCommands.st similarity index 87% rename from src/FileSystem-Git.package/GitFeatureFlags.class/class/terminalCommandForExternalCommands.st rename to src/FileSystem-Git.package/GitFeatureFlags.class/class/customTerminalCommandForExternalCommands.st index aeb060a33..81e269651 100644 --- a/src/FileSystem-Git.package/GitFeatureFlags.class/class/terminalCommandForExternalCommands.st +++ b/src/FileSystem-Git.package/GitFeatureFlags.class/class/customTerminalCommandForExternalCommands.st @@ -1,5 +1,5 @@ accessing -terminalCommandForExternalCommands +customTerminalCommandForExternalCommands >knownTerminalCommands for examples.' type: #String> - ^ TerminalCommandForExternalCommands ifNil: [''] \ No newline at end of file + ^ CustomTerminalCommandForExternalCommands ifNil: [''] \ No newline at end of file diff --git a/src/FileSystem-Git.package/GitFeatureFlags.class/class/terminalCommandForExternalCommands..st b/src/FileSystem-Git.package/GitFeatureFlags.class/class/terminalCommandForExternalCommands..st deleted file mode 100644 index 7aeaf71d1..000000000 --- a/src/FileSystem-Git.package/GitFeatureFlags.class/class/terminalCommandForExternalCommands..st +++ /dev/null @@ -1,3 +0,0 @@ -accessing -terminalCommandForExternalCommands: aString - TerminalCommandForExternalCommands := aString \ No newline at end of file diff --git a/src/FileSystem-Git.package/GitFeatureFlags.class/methodProperties.json b/src/FileSystem-Git.package/GitFeatureFlags.class/methodProperties.json index 475083e76..ec8c71830 100644 --- a/src/FileSystem-Git.package/GitFeatureFlags.class/methodProperties.json +++ b/src/FileSystem-Git.package/GitFeatureFlags.class/methodProperties.json @@ -1,5 +1,7 @@ { "class" : { + "customTerminalCommandForExternalCommands" : "mad 10/31/2024 17:50", + "customTerminalCommandForExternalCommands:" : "mad 10/31/2024 17:50", "evictFromObjectCache" : "jr 8/10/2020 23:42", "evictFromObjectCache:" : "jr 4/20/2020 21:59", "evictFromObjectCacheForTests:" : "jr 4/20/2020 23:33", @@ -7,8 +9,6 @@ "externalFetchAndPush:" : "tobe 10/15/2022 07:17", "pruneWhenFetching" : "mad 4/7/2024 18:31", "pruneWhenFetching:" : "mad 4/7/2024 14:46", - "terminalCommandForExternalCommands" : "mad 4/3/2024 16:37", - "terminalCommandForExternalCommands:" : "mad 12/20/2023 18:04", "warnAboutUseOfDeprecatedMethods" : "jr 9/21/2020 23:10", "warnAboutUseOfDeprecatedMethods:" : "jr 4/17/2020 11:49" }, "instance" : { diff --git a/src/FileSystem-Git.package/GitFeatureFlags.class/properties.json b/src/FileSystem-Git.package/GitFeatureFlags.class/properties.json index ab1858868..b235d8664 100644 --- a/src/FileSystem-Git.package/GitFeatureFlags.class/properties.json +++ b/src/FileSystem-Git.package/GitFeatureFlags.class/properties.json @@ -3,10 +3,10 @@ "classinstvars" : [ ], "classvars" : [ + "CustomTerminalCommandForExternalCommands", "EvictFromObjectCache", "ExternalFetchAndPush", "PruneWhenFetching", - "TerminalCommandForExternalCommands", "UseUnitOfWorkInterface", "WarnAboutUseOfDeprecatedMethods" ], "commentStamp" : "",