5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-18 21:46:21 +00:00

fix: hacer un merge cuando hay cambios #14533

This commit is contained in:
f 2023-10-31 13:53:45 -03:00
parent 9df84e7778
commit 9ec0dc87a9
No known key found for this signature in database
2 changed files with 10 additions and 5 deletions

View file

@ -8,6 +8,10 @@ class GitPullJob < ApplicationJob
# @param :message [String] # @param :message [String]
# @return [nil] # @return [nil]
def perform(site, usuarie, message) def perform(site, usuarie, message)
site.repository.merge(usuarie, message) if site.repository.fetch&.positive? site.repository.fetch
return if site.repository.up_to_date?
site.repository.merge(usuarie, message)
end end
end end

View file

@ -111,10 +111,11 @@ class Site
walker.each.to_a walker.each.to_a
end end
# Hay commits sin aplicar? # Detecta si hay que hacer un pull o no
def needs_pull? #
fetch # @return [Boolean]
!commits.empty? def up_to_date?
rugged.merge_analysis(remote_head_commit).include?(:up_to_date)
end end
# Guarda los cambios en git # Guarda los cambios en git