We were looking these up on each request to an issue page, because the form is
pre-filled, as is the template dropdown. That was unnecessary: we could just
treat these as 'special' repository files (like the rendered README) and cache
them in Redis until they change on a push.
The basename appears to have been a holdover from the past - it doesn't look
necessary now. Some of the regexes were unanchored on one side, so explicitly
ensure that they only match the root.
Apart from that, this means that pushing to foo/README.md will no longer
invalidate the main README cache for a project.
This moves the logic of detecting special repository files (e.g. a
README or a Koding configuration file) to a single class:
Gitlab::FileDetector. Moving this logic into a single place allows this
to be re-used more easily.
This commit also changes Repository#gitlab_ci_yaml so that its cached
similar to other data (e.g. the Koding configuration file).