in lib/rugged_adapter/git_layer_rugged.rb [290:311]
def pull(remote, branches = nil, options = {})
branches = [branches].flatten.map {|branch| "refs/heads/#{branch}" unless branch =~ /^refs\/heads\//}
r = @repo.remotes[remote]
r.fetch(branches, **options)
branches.each do |branch|
branch_name = branch.match(/^refs\/heads\/(.*)/)[1]
remote_name = remote.match(/^(refs\/heads\/)?(.*)/)[2]
remote_ref = @repo.branches["#{remote_name}/#{branch_name}"].target
local_ref = @repo.branches[branch].target
index = @repo.merge_commits(local_ref, remote_ref)
options = { author: Actor.default_actor.to_h,
committer: Actor.default_actor.to_h,
message: "Merged branch #{branch} of #{remote}.",
parents: [local_ref, remote_ref],
tree: index.write_tree(@repo),
update_ref: branch
}
Rugged::Commit.create @repo, **options
@repo.checkout(@repo.head.name, :strategy => :force) if !@repo.bare? && branch == @repo.head.name
end
end