Skip to content

Commit

Permalink
Only store custom terminal commands in preference
Browse files Browse the repository at this point in the history
Storing automatically detected terminal commands causes problems
when knownTerminalCommands is updated, because an old command
may still be stored.
  • Loading branch information
MariusDoe committed Oct 31, 2024
1 parent 0494809 commit 3d529a2
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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]
ifNone: [self requestTerminalCommand]
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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]
^ GitFeatureFlags customTerminalCommandForExternalCommands ifEmpty: [self detectTerminalCommand]
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
customTerminalCommandForExternalCommands: aString
CustomTerminalCommandForExternalCommands := aString
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
accessing
terminalCommandForExternalCommands
customTerminalCommandForExternalCommands
<preference: 'Command for spawning a terminal to run external commands' categoryList: #('Git expert settings') description: 'It should contain a pair of curly braces {} where the external command should be inserted. The braces may optionally contain a comma-separated sequence of actions: 1. {quote} quotes the command with single quotes before inserting it, 2. {abc:def} replaces all occurences of abc with def, 3. {no-key} prevents the prompt "Press any key to continue..." from being added after the command. These may be combined, e. g. {quote,":\",quote,sh:zsh}. The actions are executed left-to-right. See FileSystemGitRepository>>knownTerminalCommands for examples.' type: #String>

^ TerminalCommandForExternalCommands ifNil: ['']
^ CustomTerminalCommandForExternalCommands ifNil: ['']

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"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",
"externalFetchAndPush" : "tobe 10/15/2022 07:17",
"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" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"classinstvars" : [
],
"classvars" : [
"CustomTerminalCommandForExternalCommands",
"EvictFromObjectCache",
"ExternalFetchAndPush",
"PruneWhenFetching",
"TerminalCommandForExternalCommands",
"UseUnitOfWorkInterface",
"WarnAboutUseOfDeprecatedMethods" ],
"commentStamp" : "",
Expand Down

0 comments on commit 3d529a2

Please sign in to comment.