提交 06b8da85 编写于 作者: L Lukas Zapletal

Allow to merge with --ff-only option

上级 d0c117fa
......@@ -27,6 +27,27 @@ Feature: hub merge
Add `hub merge` command
"""
Scenario: Merge pull request with --ff-only option
Given the GitHub API server:
"""
require 'json'
get('/repos/defunkt/hub/pulls/164') { json \
:head => {
:label => 'jfirebaugh:hub_merge',
:repo => {:private => false}
},
:title => "Add `hub merge` command"
}
"""
And there is a commit named "jfirebaugh/hub_merge"
When I successfully run `hub merge --ff-only https://github.com/defunkt/hub/pull/164`
Then "git fetch git://github.com/jfirebaugh/hub.git +refs/heads/hub_merge:refs/remotes/jfirebaugh/hub_merge" should be run
When I successfully run `git show -s --format=%B`
Then the output should contain:
"""
Fast-forward (no commit created; -m option ignored)
"""
Scenario: Merge private pull request
Given the GitHub API server:
"""
......
......@@ -443,8 +443,9 @@ module Hub
idx = args.index url_arg
args.delete_at idx
args.insert idx, merge_head, '--no-ff', '-m',
"Merge pull request ##{pull_id} from #{merge_head}\n\n#{pull_data['title']}"
args.insert idx, merge_head, '-m', "Merge pull request ##{pull_id} from #{merge_head}\n\n#{pull_data['title']}"
idx = args.index '-m'
args.insert idx, '--no-ff' unless args.include?('--ff-only')
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册