5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-30 03: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:
Sutty 2023-07-21 20:53:51 +00:00
commit f24fc8f729
2 changed files with 18 additions and 1 deletions

13
app/jobs/git_pull_job.rb Normal file
View 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

View file

@ -45,7 +45,9 @@ class Site
# @return [Integer] # @return [Integer]
def fetch def fetch
if origin.check_connection(:fetch, credentials: credentials) 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 else
0 0
end end
@ -75,6 +77,8 @@ class Site
# Forzamos el checkout para mover el HEAD al último commit y # Forzamos el checkout para mover el HEAD al último commit y
# escribir los cambios # escribir los cambios
rugged.checkout 'HEAD', strategy: :force rugged.checkout 'HEAD', strategy: :force
# reemplaza los pointers por los archivos correspondientes
git_sh("git", "lfs", "checkout")
commit commit
end end