Allow to merge with --ff-only option

This commit is contained in:
Lukas Zapletal 2013-11-11 12:33:13 +01:00
Родитель d0c117fa7e
Коммит 06b8da85e9
2 изменённых файлов: 24 добавлений и 2 удалений

Просмотреть файл

@ -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