-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add preference to set git executable
- Loading branch information
Showing
9 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
src/FileSystem-Git.package/FileSystemGitRepository.class/instance/externalGitDo..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}). |
15 changes: 15 additions & 0 deletions
15
src/FileSystem-Git.package/FileSystemGitRepository.class/instance/gitExecutable.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
4 changes: 4 additions & 0 deletions
4
...ileSystem-Git.package/FileSystemGitRepository.class/instance/suggestWSLGitInstallation.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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''.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
src/FileSystem-Git.package/GitFeatureFlags.class/class/externalGitExecutable..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
externalGitExecutable: aString | ||
ExternalGitExecutable := aString |
5 changes: 5 additions & 0 deletions
5
src/FileSystem-Git.package/GitFeatureFlags.class/class/externalGitExecutable.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters