Commit cb3f8510 authored by Jakub Jirutka's avatar Jakub Jirutka Committed by Achilleas Pipinellis

Render index.* like README.* when it's present in a directory

Resolves #18933
parent c0d30fad
---
title: Make index.* render like README.* when it's present in a repository
merge_request: 16550
author: Jakub Jirutka
type: added
......@@ -8,7 +8,7 @@ module Gitlab
module FileDetector
PATTERNS = {
# Project files
readme: %r{\Areadme[^/]*\z}i,
readme: %r{\A(readme|index)[^\/]*\z}i,
changelog: %r{\A(changelog|history|changes|news)[^/]*\z}i,
license: %r{\A((un)?licen[sc]e|copying)(\.[^/]+)?\z}i,
contributing: %r{\Acontributing[^/]*\z}i,
......
......@@ -15,7 +15,11 @@ describe Gitlab::FileDetector do
describe '.type_of' do
it 'returns the type of a README file' do
expect(described_class.type_of('README.md')).to eq(:readme)
%w(README readme INDEX index).each do |filename|
%w(.md .adoc).each do |extname|
expect(described_class.type_of(filename + extname)).to eq(:readme)
end
end
end
it 'returns nil for a README file in a directory' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment