Skip to content
Snippets Groups Projects
Commit 947ed8b8 authored by Robert Speicher's avatar Robert Speicher
Browse files

Merge branch 'fix/wiki-find-file-gitaly' into 'master'

Fix finding wiki file when Gitaly is enabled

Closes gitaly#1126

See merge request gitlab-org/gitlab-ce!18317
parents 84c70f43 f6112122
No related branches found
No related tags found
No related merge requests found
---
title: Fix finding wiki file when Gitaly is enabled
merge_request:
author:
type: fixed
Loading
Loading
@@ -136,7 +136,7 @@ module Gitlab
wiki_file = nil
 
response.each do |message|
next unless message.name.present?
next unless message.name.present? || wiki_file
 
if wiki_file
wiki_file.raw_data << message.raw_data
Loading
Loading
spec/fixtures/big-image.png

317 KiB

Loading
Loading
@@ -172,11 +172,12 @@ describe ProjectWiki do
 
describe '#find_file' do
shared_examples 'finding a wiki file' do
let(:image) { File.open(Rails.root.join('spec', 'fixtures', 'big-image.png')) }
before do
file = File.open(Rails.root.join('spec', 'fixtures', 'dk.png'))
subject.wiki # Make sure the wiki repo exists
 
BareRepoOperations.new(subject.repository.path_to_repo).commit_file(file, 'image.png')
BareRepoOperations.new(subject.repository.path_to_repo).commit_file(image, 'image.png')
end
 
it 'returns the latest version of the file if it exists' do
Loading
Loading
@@ -192,6 +193,13 @@ describe ProjectWiki do
file = subject.find_file('image.png')
expect(file).to be_a Gitlab::Git::WikiFile
end
it 'returns the whole file' do
file = subject.find_file('image.png')
image.rewind
expect(file.raw_data.b).to eq(image.read.b)
end
end
 
context 'when Gitaly wiki_find_file is enabled' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment