Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
github
hub
提交
bc4b450b
H
hub
项目概览
github
/
hub
10 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
提交
bc4b450b
编写于
11月 27, 2014
作者:
M
Mislav Marohnić
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Ensure branch names with funky characters are shell-escaped
Fixes #695
上级
b311b7b3
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
29 addition
and
6 deletion
+29
-6
features/pull_request.feature
features/pull_request.feature
+12
-0
features/steps.rb
features/steps.rb
+1
-1
features/support/env.rb
features/support/env.rb
+4
-0
lib/hub/commands.rb
lib/hub/commands.rb
+6
-3
lib/hub/context.rb
lib/hub/context.rb
+6
-2
未找到文件。
features/pull_request.feature
浏览文件 @
bc4b450b
...
...
@@ -560,3 +560,15 @@ Feature: hub pull-request
"""
When
I successfully run `hub pull-request -m hereyougo`
Then the output should contain exactly "the
:
//url\n"
Scenario
:
Branch with quotation mark in name
Given
I am on the
"feat'ure"
branch with upstream
"origin/feat'ure"
Given the GitHub API server
:
"""
post('/repos/mislav/coral/pulls') {
assert :head => "mislav:feat'ure"
json :html_url => "the://url"
}
"""
When
I successfully run `hub pull-request -m hereyougo`
Then the output should contain exactly "the
:
//url\n"
features/steps.rb
浏览文件 @
bc4b450b
...
...
@@ -96,7 +96,7 @@ Given(/^I am on the "([^"]+)" branch(?: (pushed to|with upstream) "([^"]+)")?$/)
end
unless
upstream
==
'refs/heads/master'
end
track
=
type
==
'pushed to'
?
'--no-track'
:
'--track'
run_silent
%(git checkout --quiet -B #{
name} #{track} #{
upstream})
run_silent
%(git checkout --quiet -B #{
shell_escape name} #{track} #{shell_escape
upstream})
end
Given
(
/^the default branch for "([^"]+)" is "([^"]+)"$/
)
do
|
remote
,
branch
|
...
...
features/support/env.rb
浏览文件 @
bc4b450b
...
...
@@ -149,4 +149,8 @@ World Module.new {
def
announcer
@announcer
||=
super
end
def
shell_escape
(
message
)
message
.
to_s
.
gsub
(
/['"\\ $]/
)
{
|
m
|
"
\\
#{
m
}
"
}
end
}
lib/hub/commands.rb
浏览文件 @
bc4b450b
...
...
@@ -86,7 +86,7 @@ module Hub
abort
"Aborted: the origin remote doesn't point to a GitHub repository."
end
unless
sha
=
local_repo
.
git_command
(
"rev-parse -q
#{
ref
}
"
)
unless
sha
=
local_repo
.
git_command
(
"rev-parse -q
'%s'"
%
ref
.
gsub
(
"'"
,
"
\\
'"
)
)
abort
"Aborted: no revision could be determined from '
#{
ref
}
'"
end
...
...
@@ -228,8 +228,11 @@ module Hub
else
format
=
'%h (%aN, %ar)%n%w(78,3,3)%s%n%+b'
default_message
=
nil
commit_summary
=
git_command
"log --no-color --format='%s' --cherry %s...%s"
%
[
format
,
base_branch
,
remote_branch
]
commit_summary
=
git_command
"log --no-color --format='%s' --cherry '%s...%s'"
%
[
format
,
base_branch
.
to_s
.
gsub
(
"'"
,
"
\\
'"
),
remote_branch
.
to_s
.
gsub
(
"'"
,
"
\\
'"
)
]
end
options
[
:title
],
options
[
:body
]
=
pullrequest_editmsg
(
commit_summary
)
{
|
msg
,
initial_message
,
cc
|
...
...
lib/hub/context.rb
浏览文件 @
bc4b450b
...
...
@@ -355,7 +355,8 @@ module Hub
end
def
upstream
if
branch
=
local_repo
.
git_command
(
"rev-parse --symbolic-full-name
#{
short_name
}
@{upstream}"
)
escaped_name
=
short_name
.
gsub
(
"'"
,
"
\\
'"
)
if
branch
=
local_repo
.
git_command
(
"rev-parse --symbolic-full-name '
#{
escaped_name
}
@{upstream}'"
)
Branch
.
new
local_repo
,
branch
end
end
...
...
@@ -479,7 +480,10 @@ module Hub
end
def
rev_list
(
a
,
b
)
git_command
(
"rev-list --cherry-pick --right-only --no-merges
#{
a
}
...
#{
b
}
"
)
git_command
"rev-list --cherry-pick --right-only --no-merges '%s...%s'"
%
[
a
.
to_s
.
gsub
(
"'"
,
"
\\
'"
),
b
.
to_s
.
gsub
(
"'"
,
"
\\
'"
)
]
end
PWD
=
Dir
.
pwd
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录