5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-18 19:26: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]
# @return [nil]
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

View file

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