Add redirect to rename commit (#1648)
This PR ensures that changes to `REDIRECTS_FILE` are committed with the commit responsible for the corresponding git rename.
This commit is contained in:
+3
-2
@@ -303,12 +303,13 @@ module Precious
|
||||
redirect to("/#{page.escaped_url_path}")
|
||||
return
|
||||
end
|
||||
committer.commit
|
||||
|
||||
# Renaming preserves format, so add the page's format to the renamed path to retrieve the renamed page
|
||||
new_path = "#{rename}.#{Gollum::Page.format_to_ext(page.format)}"
|
||||
# Add a redirect from the old page to the new
|
||||
wiki.add_redirect(page.url_path, clean_url(new_path)) if @redirects_enabled
|
||||
wiki.add_redirect(page.url_path, clean_url(new_path), commit) if @redirects_enabled
|
||||
|
||||
committer.commit
|
||||
|
||||
page = wiki_page(new_path).page
|
||||
return if page.nil?
|
||||
|
||||
Reference in New Issue
Block a user