5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2025-03-14 20:08:19 +00:00

Merge branch 'issue-17359' into 'rails'

fix: reindexar desde el principio si cambió el repositorio #17359

See merge request sutty/sutty!280
This commit is contained in:
fauno 2025-01-27 06:49:47 +00:00
commit 520f0e828c

View file

@ -46,11 +46,19 @@ class Site
private private
# Trae el último commit indexado desde el repositorio # Trae el último commit indexado desde el repositorio, o si no
# existe, trae el primer commit.
# #
# @return [Rugged::Commit] # @return [Rugged::Commit]
def indexed_commit def indexed_commit
@indexed_commit ||= repository.rugged.lookup(last_indexed_commit) @indexed_commit ||=
if repository.rugged.exists?(last_indexed_commit)
repository.rugged.lookup(last_indexed_commit)
else
repository.rugged.lookup(
repository.rugged.references[repository.rugged.head.canonical_name].log.first[:id_new]
)
end
end end
# Calcula la diferencia entre el último commit indexado y el # Calcula la diferencia entre el último commit indexado y el