License key throws Error 500 when HEAD ponts to a ref that does not exist
If HEAD
is refs/heads/master
but the branch master
does not exist, an Error 500 occurs:
https://sentry.gitlap.com/gitlab/gitlabcom/issues/4621/
Rugged::ReferenceError: Reference 'refs/heads/master' not found
lib/gitlab/metrics/instrumentation.rb:153:in `head'
retval = super
lib/gitlab/metrics/instrumentation.rb:153:in `head'
retval = super
lib/gitlab/metrics/instrumentation.rb:153:in `last_commit'
retval = super
app/models/repository.rb:545:in `block in license_key'
Licensee.license(path).try(:key)
lib/repository_cache.rb:19:in `fetch'
backend.fetch(cache_key(key), &block)
...
(150 additional frame(s) were not displayed)
ActionView::Template::Error: Reference 'refs/heads/master' not found
lib/gitlab/metrics/instrumentation.rb:153:in `head'
retval = super
lib/gitlab/metrics/instrumentation.rb:153:in `head'
retval = super
lib/gitlab/metrics/instrumentation.rb:153:in `last_commit'
retval = super
app/models/repository.rb:545:in `block in license_key'
Licensee.license(path).try(:key)
lib/repository_cache.rb:19:in `fetch'
backend.fetch(cache_key(key), &block)
...
(150 additional frame(s) were not displayed)