From 3e12bfbe9ec950ec4dfd639717664742bc0491b6 Mon Sep 17 00:00:00 2001 From: jazzari Date: Fri, 21 Jul 2023 17:12:26 -0300 Subject: [PATCH] fix: add git lfs fetch to repository#fetch method #12980 --- app/jobs/git_pull_job.rb | 12 ++++-------- app/models/site/repository.rb | 6 +++++- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/jobs/git_pull_job.rb b/app/jobs/git_pull_job.rb index 0c9ef237..de263403 100644 --- a/app/jobs/git_pull_job.rb +++ b/app/jobs/git_pull_job.rb @@ -4,14 +4,10 @@ # hace un push al repositorio class GitPullJob < ApplicationJob # @param :site [Site] + # @param :usuarie [Usuarie] # @return [nil] - def perform(site) - # hace un fetch para ver cambios + def perform(site, usuarie) site.repository.fetch - - # hace un merge - site.repository.merge(site.usuarie) - site.repository.git_sh("git lfs fetch") - + site.repository.merge(usuarie) end - end \ No newline at end of file +end \ No newline at end of file diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index 62e4c45e..d2832091 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -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