Attempt to support non default port for git
This commit is contained in:
		
							parent
							
								
									0d469f6989
								
							
						
					
					
						commit
						821163c5b1
					
				| @ -78,6 +78,8 @@ def gclone [repo_url: string] { | ||||
|         $repo_url | parse "https://{server}/{owner}/{repo}" | get 0 | ||||
|     } else if ($repo_url | str starts-with "http://") { | ||||
|         $repo_url | parse "http://{server}/{owner}/{repo}" | get 0 | ||||
|     } else if ($repo_url | str starts-with "ssh://") { | ||||
|         $repo_url | parse "ssh://git@{server}/{owner}/{repo}" | get 0 | ||||
|     } else if ($repo_url | str starts-with "git@") { | ||||
|         $repo_url | parse "git@{server}:{owner}/{repo}" | get 0 | ||||
|     } else { | ||||
| @ -90,10 +92,16 @@ def gclone [repo_url: string] { | ||||
|     } | ||||
| 
 | ||||
|     let server = $attr.server | ||||
|     let server_portless = $attr.server | split row ':' | get 0 | ||||
|     let owner = $attr.owner | ||||
|     let repo = $attr.repo | ||||
| 
 | ||||
|     let target = [$env.GCLONE_PATH, $server, $owner, $repo] | path join | ||||
|     let target = [$env.GCLONE_PATH, $server_portless, $owner, $repo] | path join | ||||
|     let target = if ($target | str ends-with '.git') { | ||||
|         $target | path parse | update extension "" | get parent stem | str join "/" | ||||
|     } else { | ||||
|         $target | ||||
|     } | ||||
| 
 | ||||
|     if ($target | path exists) { | ||||
|         print ( | ||||
| @ -105,7 +113,7 @@ def gclone [repo_url: string] { | ||||
|     } | ||||
| 
 | ||||
|     let clone_url = if $env.GCLONE_FORCE_SSH { | ||||
|         $attr | format "git@{server}:{owner}/{repo}" | ||||
|         $attr | format "ssh://git@{server}/{owner}/{repo}" | ||||
|     } else { | ||||
|         $repo_url | ||||
|     } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user