Commit b520e1f5 authored by Kyle Fuller's avatar Kyle Fuller

[Sources] Use `git pull` with the `--ff-only` flag

This fixes issue where since we were using `--no-commit`, git was
starting a merge but not committing it. Then subsequent `git pull`'s would
result in the following error from git:

> You have not concluded your merge (MERGE_HEAD exists).
> Please, commit your changes before you can merge.

This commit will mean that `--ff-only` is passed to `git pull`  which means
it wont rebase or merge. It will only allow a fast forward to progress
with the pull.

Fixes #2024
parent 1fcac040
...@@ -153,7 +153,7 @@ module Pod ...@@ -153,7 +153,7 @@ module Pod
UI.section "Updating spec repo `#{source.name}`" do UI.section "Updating spec repo `#{source.name}`" do
Dir.chdir(source.data_provider.repo) do Dir.chdir(source.data_provider.repo) do
begin begin
output = git!("pull --no-rebase --no-commit") output = git!("pull --ff-only")
UI.puts output if show_output && !config.verbose? UI.puts output if show_output && !config.verbose?
rescue Informative => e rescue Informative => e
raise Informative, 'An error occurred while performing ' \ raise Informative, 'An error occurred while performing ' \
......
...@@ -116,20 +116,13 @@ module Pod ...@@ -116,20 +116,13 @@ module Pod
set_up_test_repo_for_update set_up_test_repo_for_update
SourcesManager.update(test_repo_path.basename.to_s, true) SourcesManager.update(test_repo_path.basename.to_s, true)
UI.output.should.match /Already up-to-date/ UI.output.should.match /is up to date/
end end
it "is robust against user settings for git repos" do it "uses the only fast forward git option" do
set_up_test_repo_for_update set_up_test_repo_for_update
SourcesManager.expects(:git!).with() { |options| options.should.match /--no-rebase/ } SourcesManager.expects(:git!).with() { |options| options.should.match /--ff-only/ }
SourcesManager.update(test_repo_path.basename.to_s, true)
end
it "doesn't allow merge commits" do
set_up_test_repo_for_update
SourcesManager.expects(:git!).with() { |options| options.should.match /--no-commit/ }
SourcesManager.update(test_repo_path.basename.to_s, true) SourcesManager.update(test_repo_path.basename.to_s, true)
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment