mirror of
https://github.com/discourse/discourse.git
synced 2025-06-05 08:07:17 +08:00
FIX: Gracefully handle force pushes for remote themes (#11325)
Force pushing a commit to a theme repository used to break the updater, because the system was not able to count the commits behind the old and new version. This operation failed because a force push deleted the old commits. The user was prompted with a simple "500 server error" message.
This commit is contained in:
@ -35,7 +35,7 @@ class ThemeStore::GitImporter
|
||||
|
||||
Discourse::Utils.execute_command(chdir: @temp_folder) do |runner|
|
||||
commit_hash = runner.exec("git", "rev-parse", "HEAD").strip
|
||||
commits_behind = runner.exec("git", "rev-list", "#{hash}..HEAD", "--count").strip
|
||||
commits_behind = runner.exec("git", "rev-list", "#{hash}..HEAD", "--count").strip rescue -1
|
||||
end
|
||||
|
||||
[commit_hash, commits_behind]
|
||||
|
Reference in New Issue
Block a user