Skip to content

Commit

Permalink
Add preference to set git executable
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusDoe committed Nov 10, 2024
1 parent 8ae6dc3 commit 52e1612
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ cloneExternalFrom: aStringOrUrl
(children isEmpty or: [children size = 1 and: [children first basename = '.git']])
ifFalse: [^ self error: 'Target directory is not empty'].
directory deleteAll.
self externalCommand: ('git clone "{1}" "{2}"' format: {aStringOrUrl. directory pathName}).
self externalCommand: ('{1} clone "{2}" "{3}"' format: {
self gitExecutable.
aStringOrUrl.
directory pathName}).
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
git porcelain - external
externalGitDo: aCommandLineSuffix
self externalCommand: ('git -C "{1}" {2}' format: {repository workingDir pathName. aCommandLineSuffix}).
self externalCommand: ('{1} -C "{2}" {3}' format: {
self gitExecutable.
repository workingDir pathName.
aCommandLineSuffix}).
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
git porcelain - external
gitExecutable
| exec |
exec := GitFeatureFlags externalGitExecutable.
(self commandExists: exec) ifTrue: [^ exec].
exec := UIManager default
request:
('Git could not be found at the path below.
Please install it or provide a path to the git executable. {1}'
withoutLineEndings withBlanksCondensed
format: {self suggestWSLGitInstallation})
initialAnswer: exec.
exec isEmptyOrNil ifTrue: [^ self error: 'Missing external git installation'].
GitFeatureFlags externalGitExecutable: exec.
^ self gitExecutable
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
git porcelain - external
suggestWSLGitInstallation
(OSProcess isWindows and: [self commandExists: 'wsl']) ifFalse: [^ ''].
^ 'If git is installed in WSL, you can also enter ''wsl git''.'
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"branchNamed:" : "jr 3/2/2020 22:13",
"branchNames" : "jr 3/3/2020 21:45",
"branches" : "jr 3/4/2020 00:46",
"cloneExternalFrom:" : "mad 5/23/2024 21:12",
"cloneExternalFrom:" : "mad 11/10/2024 16:45",
"cloneFrom:" : "mad 5/23/2024 18:12",
"cloneInternalFrom:" : "mad 5/23/2024 18:11",
"commandExists:" : "mad 4/3/2024 15:10",
Expand All @@ -15,14 +15,15 @@
"detectTerminalCommand" : "mad 10/31/2024 17:49",
"expandRemoteRef:" : "pre 6/15/2018 16:04",
"externalCommand:" : "mad 11/4/2024 12:53",
"externalGitDo:" : "mad 5/22/2024 13:29",
"externalGitDo:" : "mad 11/10/2024 16:44",
"externalPush:toRemote:force:" : "mad 5/18/2024 12:26",
"fetchAllExternalFrom:" : "mad 5/23/2024 18:46",
"fetchFrom:" : "mad 5/23/2024 18:10",
"fetchFromAll:" : "mad 4/22/2024 17:25",
"fetchInternalFrom:" : "mad 4/22/2024 17:24",
"filesystemOn:" : "CamilloBruni 8/30/2012 14:06",
"flushCaches" : "jr 7/2/2017 19:12",
"gitExecutable" : "mad 11/10/2024 17:04",
"gitStoreOn:" : "CamilloBruni 9/2/2012 12:33",
"handleConnectionClosed:whileTryingTo:ifRetry:" : "mad 4/22/2024 17:21",
"handleTerminalCommandTemplateCharacter:from:into:withCommand:" : "mad 10/9/2024 15:07",
Expand All @@ -47,6 +48,7 @@
"removeRemoteNamed:" : "jr 3/4/2020 00:49",
"repository" : "CamilloBruni 6/22/2011 05:08",
"requestTerminalCommand" : "mad 10/31/2024 17:50",
"suggestWSLGitInstallation" : "mad 11/10/2024 17:03",
"tagNamed:" : "MCGitRepositoryTest 3/3/2020 23:40",
"tagNames" : "MCGitRepositoryTest 3/3/2020 23:42",
"tags" : "jr 3/4/2020 00:49",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
externalGitExecutable: aString
ExternalGitExecutable := aString
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
externalGitExecutable
<preference: 'External git executable' categoryList: #('Git expert settings') description: 'A replacement for ''git'' in commands like ''git fetch''. Can be a path to an executable or something like ''wsl git'' to use the git installation in wsl. Spaces (in paths) are not escaped to support the latter use case.' type: #String>

^ ExternalGitExecutable ifNil: ['git']
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"evictFromObjectCacheForTests:" : "jr 4/20/2020 23:33",
"externalFetchAndPush" : "tobe 10/15/2022 07:17",
"externalFetchAndPush:" : "tobe 10/15/2022 07:17",
"externalGitExecutable" : "mad 11/10/2024 16:52",
"externalGitExecutable:" : "mad 11/10/2024 16:52",
"pruneWhenFetching" : "mad 4/7/2024 18:31",
"pruneWhenFetching:" : "mad 4/7/2024 14:46",
"warnAboutUseOfDeprecatedMethods" : "jr 9/21/2020 23:10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"CustomTerminalCommandForExternalCommands",
"EvictFromObjectCache",
"ExternalFetchAndPush",
"ExternalGitExecutable",
"PruneWhenFetching",
"UseUnitOfWorkInterface",
"WarnAboutUseOfDeprecatedMethods" ],
Expand Down

0 comments on commit 52e1612

Please sign in to comment.