diff --git a/Iceberg-Pharo6.package/MCGitlabRepository.extension/instance/scpUrl.st b/Iceberg-Pharo6.package/MCGitlabRepository.extension/instance/scpUrl.st new file mode 100644 index 0000000000..260d2135dd --- /dev/null +++ b/Iceberg-Pharo6.package/MCGitlabRepository.extension/instance/scpUrl.st @@ -0,0 +1,6 @@ +*Iceberg-Pharo6 +sshPort + "In pharo 6 we do not have the code to be able to load gitlab with non default ssh port projects. So we return nil so that #scpUrl does not break." + + ^ nil + \ No newline at end of file diff --git a/Iceberg-Tests.package/MCGitlabRepositoryIcebergExtensionsTest.class/instance/testScpUrlForSelfHostedGitlabWithNonDefaultSSHPort.st b/Iceberg-Tests.package/MCGitlabRepositoryIcebergExtensionsTest.class/instance/testScpUrlForSelfHostedGitlabWithNonDefaultSSHPort.st new file mode 100644 index 0000000000..71cb498fb5 --- /dev/null +++ b/Iceberg-Tests.package/MCGitlabRepositoryIcebergExtensionsTest.class/instance/testScpUrlForSelfHostedGitlabWithNonDefaultSSHPort.st @@ -0,0 +1,7 @@ +running +testScpUrlForSelfHostedGitlabWithNonDefaultSSHPort + | repository | + SystemVersion current major <= 6 ifTrue: [ self skip ]. + + repository := MCGitlabRepository location: 'gitlab://git.pharo.org:1234:pharo-project/pharo'. + self assert: repository scpUrl equals: 'ssh://git@git.pharo.org:1234/pharo-project/pharo.git' \ No newline at end of file diff --git a/Iceberg.package/MCGitlabRepository.extension/instance/scpUrl.st b/Iceberg.package/MCGitlabRepository.extension/instance/scpUrl.st index 3d3054e7e3..a1b5cad9e9 100644 --- a/Iceberg.package/MCGitlabRepository.extension/instance/scpUrl.st +++ b/Iceberg.package/MCGitlabRepository.extension/instance/scpUrl.st @@ -1,3 +1,7 @@ *Iceberg scpUrl - ^ 'git@<1s>:<2s>.git' expandMacrosWith: self hostname with: projectPath \ No newline at end of file + "If the sshPort is not nil it means that we have a non default ssh port. Thus we need to add `ssh://` and th port number to the scheme" + + ^ self sshPort + ifNil: [ 'git@<1s>:<2s>.git' expandMacrosWith: self hostname with: projectPath ] + ifNotNil: [ :port | 'ssh://git@<1s>:<2s>/<3s>.git' expandMacrosWith: self hostname with: port with: projectPath ] \ No newline at end of file