From 0e0884fe2e2efcc4be59baf6d59e1d2c9e5a4e4b Mon Sep 17 00:00:00 2001 From: Simar Date: Tue, 15 Jun 2021 14:05:49 -0400 Subject: [PATCH 1/3] Added allow_unrelated_histories option support for pull --- lib/git/lib.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/git/lib.rb b/lib/git/lib.rb index 191b8a74..ccc431fa 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -888,8 +888,12 @@ def push(remote, branch = 'master', opts = {}) end end - def pull(remote='origin', branch='master') - command('pull', remote, branch) + def pull(remote='origin', branch='master', opts = {}) + + arr_opts = [] + arr_opts << '--allow-unrelated-histories' if opts[:allow_unrelated_histories] + + command('pull', remote, branch, arr_opts) end def tag_sha(tag_name) From 9f4cd12ef519908cce71c0da367167f5761bb039 Mon Sep 17 00:00:00 2001 From: Simar Date: Tue, 15 Jun 2021 14:16:21 -0400 Subject: [PATCH 2/3] added opts to base.rb > pull method --- lib/git/base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/git/base.rb b/lib/git/base.rb index 50459215..785bfc02 100644 --- a/lib/git/base.rb +++ b/lib/git/base.rb @@ -386,8 +386,8 @@ def each_conflict(&block) # :yields: file, your_version, their_version # @git.pull('upstream') # pulls from upstream/master # @git.pull('upstream', 'develope') # pulls from upstream/develop # - def pull(remote='origin', branch='master') - self.lib.pull(remote, branch) + def pull(remote='origin', branch='master', opts = {}) + self.lib.pull(remote, branch, opts) end # returns an array of Git:Remote objects From 1eb62e22127962c447acdc8fcfdd8245da42d81f Mon Sep 17 00:00:00 2001 From: Simar Date: Tue, 15 Jun 2021 15:20:41 -0400 Subject: [PATCH 3/3] Update lib.rb --- lib/git/lib.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/git/lib.rb b/lib/git/lib.rb index ccc431fa..3dbba64b 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -891,6 +891,7 @@ def push(remote, branch = 'master', opts = {}) def pull(remote='origin', branch='master', opts = {}) arr_opts = [] + arr_opts << '--rebase' if opts[:rebase] arr_opts << '--allow-unrelated-histories' if opts[:allow_unrelated_histories] command('pull', remote, branch, arr_opts)