Skip to content
Snippets Groups Projects
Commit 7f3228ec authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Merge branch 'master' of github.com:gitlabhq/gitlabhq

parents b8d48ca8 01af2c98
No related branches found
No related tags found
No related merge requests found
Please view this file on the master branch, on stable branches it's out of date.
 
v 7.14.0 (unreleased)
- Fix corrupted binary files when using API files endpoint (Stan Hu)
- Show incompatible projects in Bitbucket import status (Stan Hu)
- Fix coloring of diffs on MR Discussion-tab (Gert Goet)
- Fix "Network" and "Graphs" pages for branches with encoded slashes (Stan Hu)
Loading
Loading
@@ -47,6 +48,10 @@ v 7.14.0 (unreleased)
- Improve MR merge widget text and UI consistency.
- Improve text in MR "How To Merge" modal.
- Cache all events
- Order commits by date when comparing branches
- Fix bug causing error when the target branch of a symbolic ref was deleted
- Include branch/tag name in archive file and directory name
- Add dropzone upload progress
 
v 7.13.3
- Fix bug causing Bitbucket importer to crash when OAuth application had been removed.
Loading
Loading
Loading
Loading
@@ -38,7 +38,7 @@ gem "browser", '~> 0.8.0'
 
# Extracting information from a git repository
# Provide access to Gitlab::Git library
gem "gitlab_git", '~> 7.2.6'
gem "gitlab_git", '~> 7.2.11'
 
# Ruby/Rack Git Smart-HTTP Server Handler
# GitLab fork with a lot of changes (improved thread-safety, better memory usage etc)
Loading
Loading
Loading
Loading
@@ -271,7 +271,7 @@ GEM
mime-types (~> 1.19)
gitlab_emoji (0.1.0)
gemojione (~> 2.0)
gitlab_git (7.2.6)
gitlab_git (7.2.11)
activesupport (~> 4.0)
charlock_holmes (~> 0.6)
gitlab-linguist (~> 3.0)
Loading
Loading
@@ -783,7 +783,7 @@ DEPENDENCIES
gitlab-grack (~> 2.0.2)
gitlab-linguist (~> 3.0.1)
gitlab_emoji (~> 0.1)
gitlab_git (~> 7.2.6)
gitlab_git (~> 7.2.11)
gitlab_meta (= 7.0)
gitlab_omniauth-ldap (= 1.2.1)
gollum-lib (~> 4.0.2)
Loading
Loading
Loading
Loading
@@ -67,7 +67,7 @@ module API
file_path: blob.path,
size: blob.size,
encoding: "base64",
content: Base64.encode64(blob.data),
content: Base64.strict_encode64(blob.data),
ref: ref,
blob_id: blob.id,
commit_id: commit.id,
Loading
Loading
Loading
Loading
@@ -93,16 +93,27 @@ module Rouge
end
 
def process_tokens(tokens)
num_lines = 0
last_val = ''
rendered = ''
rendered = []
current_line = ''
 
tokens.each do |tok, val|
last_val = val
num_lines += val.scan(/\n/).size
rendered << span(tok, val)
# In the case of multi-line values (e.g. comments), we need to apply
# styling to each line since span elements are inline.
val.lines.each do |line|
stripped = line.chomp
current_line << span(tok, stripped)
if line.end_with?("\n")
rendered << current_line
current_line = ''
end
end
end
 
# Add leftover text
rendered << current_line if current_line.present?
num_lines = rendered.size
numbers = (@linenostart..num_lines + @linenostart - 1).to_a
 
{ numbers: numbers, code: rendered }
Loading
Loading
@@ -117,9 +128,8 @@ module Rouge
numbers.join("\n")
end
 
def wrap_lines(rendered)
def wrap_lines(lines)
if @lineanchors
lines = rendered.split("\n")
lines = lines.each_with_index.map do |line, index|
number = index + @linenostart
 
Loading
Loading
@@ -136,24 +146,17 @@ module Rouge
lines.join("\n")
else
if @linenos == 'inline'
lines = rendered.split("\n")
lines = lines.each_with_index.map do |line, index|
number = index + @linenostart
"<span class=\"linenos\">#{number}</span>#{line}"
end
lines.join("\n")
else
rendered
lines.join("\n")
end
end
end
 
def wrap_values(val, element)
lines = val.split("\n")
lines = lines.map{ |x| "<span #{element}>#{x}</span>" }
lines.join("\n")
end
def span(tok, val)
# http://stackoverflow.com/a/1600584/2587286
val = CGI.escapeHTML(val)
Loading
Loading
@@ -161,13 +164,11 @@ module Rouge
if tok.shortname.empty?
val
else
# In the case of multi-line values (e.g. comments), we need to apply
# styling to each line since span elements are inline.
if @inline_theme
rules = @inline_theme.style_for(tok).rendered_rules
wrap_values(val, "style=\"#{rules.to_a.join(';')}\"")
"<span style=\"#{rules.to_a.join(';')}\"#{val}</span>"
else
wrap_values(val, "class=\"#{tok.shortname}\"")
"<span class=\"#{tok.shortname}\">#{val}</span>"
end
end
end
Loading
Loading
Loading
Loading
@@ -47,5 +47,21 @@ describe BlobHelper do
expect(lines[1].text).to eq(' This is line 2.')
expect(lines[2].text).to eq(' """')
end
context 'diff highlighting' do
let(:blob_name) { 'test.diff' }
let(:blob_content) { "+aaa\n+bbb\n- ccc\n ddd\n"}
let(:expected) do
%q(<span id="LC1" class="line"><span class="gi">+aaa</span></span>
<span id="LC2" class="line"><span class="gi">+bbb</span></span>
<span id="LC3" class="line"><span class="gd">- ccc</span></span>
<span id="LC4" class="line"> ddd</span>)
end
it 'should highlight each line properly' do
result = highlight(blob_name, blob_content, nowrap: true, continue: false)
expect(result).to eq(expected)
end
end
end
end
Loading
Loading
@@ -58,7 +58,7 @@ describe EventsHelper do
expected = '<pre class="code highlight white ruby">' \
"<code><span class=\"k\">def</span> <span class=\"nf\">test</span>\n" \
" <span class=\"s1\">\'hello world\'</span>\n" \
"<span class=\"k\">end</span>\n" \
"<span class=\"k\">end</span>" \
'</code></pre>'
expect(event_note(input)).to eq(expected)
end
Loading
Loading
Loading
Loading
@@ -117,4 +117,35 @@ describe API::API, api: true do
expect(response.status).to eq(400)
end
end
describe "POST /projects/:id/repository/files with binary file" do
let(:file_path) { 'test.bin' }
let(:put_params) do
{
file_path: file_path,
branch_name: 'master',
content: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=',
commit_message: 'Binary file with a \n should not be touched',
encoding: 'base64'
}
end
let(:get_params) do
{
file_path: file_path,
ref: 'master',
}
end
before do
post api("/projects/#{project.id}/repository/files", user), put_params
end
it "remains unchanged" do
get api("/projects/#{project.id}/repository/files", user), get_params
expect(response.status).to eq(200)
expect(json_response['file_path']).to eq(file_path)
expect(json_response['file_name']).to eq(file_path)
expect(json_response['content']).to eq(put_params[:content])
end
end
end
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