Skip to content

Commit

Permalink
current_commit should not crash if git is unavailable or on cache fai…
Browse files Browse the repository at this point in the history
…lures
  • Loading branch information
Oaphi committed Dec 8, 2024
1 parent 92315f2 commit 52522d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,5 +202,7 @@ def current_commit
end

[shasum, date]
rescue
[nil, nil]
end
end
4 changes: 2 additions & 2 deletions app/views/layouts/_footer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
</div>
</div>
<% sha, date = current_commit %>
<p>Powered by <%= link_to 'Codidact', 'https://codidact.org/' %>. Version <%=
<p>Powered by <%= link_to 'Codidact', 'https://codidact.org/' %>. <% if sha&.present? %> Version <%=
link_to sha[0..7], "https://github.com/codidact/qpixel/commit/#{sha}"
%> (<%= date.to_time.utc.strftime('%F %TZ') %>)
%> (<%= date.to_time.utc.strftime('%F %TZ') %>)<% end %>
</p>
</div>
</footer>

0 comments on commit 52522d0

Please sign in to comment.