Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
github
hub
提交
3dad4373
H
hub
项目概览
github
/
hub
11 个月 前同步成功
通知
3
Star
22523
Fork
2406
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3dad4373
编写于
7月 19, 2012
作者:
M
Mislav Marohnić
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support ssh.github.com
Fixes #208
上级
ec15f331
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
9 deletion
+26
-9
lib/hub/context.rb
lib/hub/context.rb
+6
-1
test/hub_test.rb
test/hub_test.rb
+20
-5
test/ssh_config
test/ssh_config
+0
-3
未找到文件。
lib/hub/context.rb
浏览文件 @
3dad4373
...
@@ -185,7 +185,11 @@ module Hub
...
@@ -185,7 +185,11 @@ module Hub
end
end
def
known_hosts
def
known_hosts
git_config
(
'hub.host'
,
:all
).
to_s
.
split
(
"
\n
"
)
+
[
default_host
]
hosts
=
git_config
(
'hub.host'
,
:all
).
to_s
.
split
(
"
\n
"
)
hosts
<<
default_host
# support ssh.github.com
# https://help.github.com/articles/using-ssh-over-the-https-port
hosts
<<
"ssh.
#{
default_host
}
"
end
end
def
self
.
default_host
def
self
.
default_host
...
@@ -217,6 +221,7 @@ module Hub
...
@@ -217,6 +221,7 @@ module Hub
def
initialize
(
*
args
)
def
initialize
(
*
args
)
super
super
self
.
host
||=
(
local_repo
||
LocalRepo
).
default_host
self
.
host
||=
(
local_repo
||
LocalRepo
).
default_host
self
.
host
=
host
.
sub
(
/^ssh\./i
,
''
)
if
'ssh.github.com'
==
host
.
downcase
end
end
def
private?
def
private?
...
...
test/hub_test.rb
浏览文件 @
3dad4373
...
@@ -4,6 +4,7 @@ require 'rbconfig'
...
@@ -4,6 +4,7 @@ require 'rbconfig'
require
'yaml'
require
'yaml'
require
'forwardable'
require
'forwardable'
require
'fileutils'
require
'fileutils'
require
'tempfile'
WebMock
::
BodyPattern
.
class_eval
do
WebMock
::
BodyPattern
.
class_eval
do
undef
normalize_hash
undef
normalize_hash
...
@@ -578,12 +579,19 @@ class HubTest < Test::Unit::TestCase
...
@@ -578,12 +579,19 @@ class HubTest < Test::Unit::TestCase
end
end
def
test_hub_browse_ssh_alias
def
test_hub_browse_ssh_alias
with_ssh_config
do
with_ssh_config
"Host gh
\n
User git
\n
HostName github.com"
do
stub_repo_url
"gh:singingwolfboy/sekrit.git"
stub_repo_url
"gh:singingwolfboy/sekrit.git"
assert_command
"browse"
,
"open https://github.com/singingwolfboy/sekrit"
assert_command
"browse"
,
"open https://github.com/singingwolfboy/sekrit"
end
end
end
end
def
test_hub_browse_ssh_github_alias
with_ssh_config
"Host github.com
\n
HostName ssh.github.com"
do
stub_repo_url
"git@github.com:suan/git-sanity.git"
assert_command
"browse"
,
"open https://github.com/suan/git-sanity"
end
end
def
test_custom_browser
def
test_custom_browser
with_browser_env
(
"custom"
)
do
with_browser_env
(
"custom"
)
do
assert_browser
(
"custom"
)
assert_browser
(
"custom"
)
...
@@ -748,10 +756,17 @@ class HubTest < Test::Unit::TestCase
...
@@ -748,10 +756,17 @@ class HubTest < Test::Unit::TestCase
Hub
::
Commands
.
send
:improved_help_text
Hub
::
Commands
.
send
:improved_help_text
end
end
def
with_ssh_config
def
with_ssh_config
content
config_file
=
File
.
expand_path
'../ssh_config'
,
__FILE__
config_file
=
Tempfile
.
open
'ssh_config'
Hub
::
SshConfig
::
CONFIG_FILES
.
replace
[
config_file
]
config_file
<<
content
yield
config_file
.
close
begin
Hub
::
SshConfig
::
CONFIG_FILES
.
replace
[
config_file
.
path
]
yield
ensure
config_file
.
unlink
end
end
end
end
end
test/ssh_config
已删除
100644 → 0
浏览文件 @
ec15f331
Host
gh
User
git
HostName
github.com
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录