5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 01:41:42 +00:00

fix: add git lfs fetch to repository#fetch method #12980

This commit is contained in:
jazzari 2023-07-21 17:12:26 -03:00
parent d77b8ba67b
commit 3e12bfbe9e
2 changed files with 9 additions and 9 deletions

View file

@ -4,14 +4,10 @@
# hace un push al repositorio # hace un push al repositorio
class GitPullJob < ApplicationJob class GitPullJob < ApplicationJob
# @param :site [Site] # @param :site [Site]
# @param :usuarie [Usuarie]
# @return [nil] # @return [nil]
def perform(site) def perform(site, usuarie)
# hace un fetch para ver cambios
site.repository.fetch site.repository.fetch
site.repository.merge(usuarie)
# hace un merge
site.repository.merge(site.usuarie)
site.repository.git_sh("git lfs fetch")
end
end 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