Commit 739e2111 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'mr-origin-7855' into 'master'

Adds a default commit message when adding a README (#25167)

Closes #25167

See merge request !7903
parents 44dc4173 3ababa74
...@@ -390,21 +390,7 @@ module ProjectsHelper ...@@ -390,21 +390,7 @@ module ProjectsHelper
"success" "success"
end end
end end
def new_readme_path
ref = @repository.root_ref if @repository
ref ||= 'master'
namespace_project_new_blob_path(@project.namespace, @project, tree_join(ref), file_name: 'README.md')
end
def new_license_path
ref = @repository.root_ref if @repository
ref ||= 'master'
namespace_project_new_blob_path(@project.namespace, @project, tree_join(ref), file_name: 'LICENSE')
end
def readme_cache_key def readme_cache_key
sha = @project.commit.try(:sha) || 'nil' sha = @project.commit.try(:sha) || 'nil'
[@project.path_with_namespace, sha, "readme"].join('-') [@project.path_with_namespace, sha, "readme"].join('-')
......
...@@ -18,5 +18,5 @@ ...@@ -18,5 +18,5 @@
distributed with computer software, forming part of its documentation. distributed with computer software, forming part of its documentation.
%p %p
We recommend you to We recommend you to
= link_to "add a README", new_readme_path, class: 'underlined-link' = link_to "add a README", add_special_file_path(@project, file_name: 'README.md'), class: 'underlined-link'
file to the repository and GitLab will render it here instead of this message. file to the repository and GitLab will render it here instead of this message.
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
%p %p
Otherwise you can start with adding a Otherwise you can start with adding a
= succeed ',' do = succeed ',' do
= link_to "README", new_readme_path, class: 'underlined-link' = link_to "README", add_special_file_path(@project, file_name: 'README.md'), class: 'underlined-link'
a a
= succeed ',' do = succeed ',' do
= link_to "LICENSE", add_special_file_path(@project, file_name: 'LICENSE'), class: 'underlined-link' = link_to "LICENSE", add_special_file_path(@project, file_name: 'LICENSE'), class: 'underlined-link'
......
---
title: Provides a sensible default message when adding a README to a project
merge_request: 7903
author:
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