#222: Added checking of sha according to Alexander's comment

This commit is contained in:
Vokhmin Alexey V 2013-07-22 18:38:18 +04:00
parent 079f8a955a
commit c935120398
1 changed files with 1 additions and 1 deletions

View File

@ -35,7 +35,7 @@ module Modules
# TODO: return something else instead of empty string on success and error
def restore_branch(branch, sha, user)
return false if branch.blank? || sha.blank?
return false if branch.blank? || sha.blank? || repo.commit(sha).nil?
repo.git.native(:branch, {}, branch, sha)
Resque.enqueue(GitHook, owner.uname, name, sha, GitHook::ZERO, "refs/heads/#{branch}", 'commit', "user-#{user.id}", nil)
return true