mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-30 01:36:22 +00:00
Merge branch 'issue-12980' of https://0xacab.org/sutty/sutty into 17.3.alpine.panel.sutty.nl
This commit is contained in:
commit
f24fc8f729
2 changed files with 18 additions and 1 deletions
13
app/jobs/git_pull_job.rb
Normal file
13
app/jobs/git_pull_job.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Permite traer los cambios cada vez que se
|
||||
# hace un push al repositorio
|
||||
class GitPullJob < ApplicationJob
|
||||
# @param :site [Site]
|
||||
# @param :usuarie [Usuarie]
|
||||
# @return [nil]
|
||||
def perform(site, usuarie)
|
||||
site.repository.fetch
|
||||
site.repository.merge(usuarie)
|
||||
end
|
||||
end
|
|
@ -45,7 +45,9 @@ class Site
|
|||
# @return [Integer]
|
||||
def fetch
|
||||
if origin.check_connection(:fetch, credentials: credentials)
|
||||
rugged.fetch(origin, credentials: credentials)[:received_objects]
|
||||
rugged.fetch(origin, credentials: credentials)[:received_objects].tap do |objects|
|
||||
git_sh("git", "lfs", "fetch", "origin", default_branch) if objects&.positive?
|
||||
end
|
||||
else
|
||||
0
|
||||
end
|
||||
|
@ -75,6 +77,8 @@ class Site
|
|||
# Forzamos el checkout para mover el HEAD al último commit y
|
||||
# escribir los cambios
|
||||
rugged.checkout 'HEAD', strategy: :force
|
||||
# reemplaza los pointers por los archivos correspondientes
|
||||
git_sh("git", "lfs", "checkout")
|
||||
commit
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue