diff options
author | Francisco Javier López <fjlopez@gitlab.com> | 2021-06-21 19:49:11 +0300 |
---|---|---|
committer | Francisco Javier López <fjlopez@gitlab.com> | 2021-06-25 08:15:45 +0300 |
commit | a1395884165c14f0dbaa21bb59209b026d60edf6 (patch) | |
tree | e6c76a35b3a09ea6e09f1d4d6da755afc890c69c /ruby/lib/gitlab/git/wiki.rb | |
parent | 56aa9a2196f0003bc011e4152bb093b8d32be83d (diff) |
Retrieve ref from unborn HEAD for wikis
In order to allow working with different branches in wikis,
we need to change the way the gollum wiki is instantiated.
We need to pass the default branch in HEAD when we instantiate
the gollum wiki, otherwise it will always default to `master`.
Changelog: added
Diffstat (limited to 'ruby/lib/gitlab/git/wiki.rb')
-rw-r--r-- | ruby/lib/gitlab/git/wiki.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ruby/lib/gitlab/git/wiki.rb b/ruby/lib/gitlab/git/wiki.rb index 452351afd..506b4489f 100644 --- a/ruby/lib/gitlab/git/wiki.rb +++ b/ruby/lib/gitlab/git/wiki.rb @@ -60,11 +60,18 @@ module Gitlab end def gollum_wiki - @gollum_wiki ||= Gollum::Wiki.new(@repository.path) + options = {} + options[:ref] = gollum_default_ref if gollum_default_ref + + @gollum_wiki ||= Gollum::Wiki.new(@repository.path, options) end private + def gollum_default_ref + @gollum_default_ref ||= @repository.root_ref || @repository.head_symbolic_ref + end + def new_page(gollum_page) Gitlab::Git::WikiPage.new(gollum_page, new_version(gollum_page, gollum_page.version.id)) end |