Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b7b82dce
Commit
b7b82dce
authored
Jul 07, 2020
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch '216458-remove-tempfile-from-external-diff-creation' into 'master'"
This reverts merge request !35750
parent
c75c0662
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
21 deletions
+12
-21
app/models/merge_request_diff.rb
app/models/merge_request_diff.rb
+10
-10
changelogs/unreleased/216458-remove-tempfile-from-external-diff-creation.yml
...ed/216458-remove-tempfile-from-external-diff-creation.yml
+0
-5
lib/carrier_wave_string_file.rb
lib/carrier_wave_string_file.rb
+2
-6
No files found.
app/models/merge_request_diff.rb
View file @
b7b82dce
...
...
@@ -493,6 +493,8 @@ class MergeRequestDiff < ApplicationRecord
self
.
stored_externally
=
true
rows
ensure
tempfile
&
.
unlink
end
def
create_merge_request_diff_files
(
rows
)
...
...
@@ -503,19 +505,17 @@ class MergeRequestDiff < ApplicationRecord
end
def
build_external_diff_tempfile
(
rows
)
pos
=
0
Tempfile
.
open
(
external_diff
.
filename
)
do
|
file
|
rows
.
each
do
|
row
|
data
=
row
.
delete
(
:diff
)
row
[
:external_diff_offset
]
=
file
.
pos
row
[
:external_diff_size
]
=
data
.
bytesize
segments
=
rows
.
map
do
|
row
|
segment
=
row
.
delete
(
:diff
)
row
[
:external_diff_offset
]
=
pos
row
[
:external_diff_size
]
=
segment
.
bytesize
pos
+=
segment
.
bytesize
file
.
write
(
data
)
end
segment
file
end
CarrierWaveStringFile
.
new
(
segments
.
join
(
''
),
external_diff
.
filename
)
end
def
build_merge_request_diff_files
(
diffs
)
...
...
changelogs/unreleased/216458-remove-tempfile-from-external-diff-creation.yml
deleted
100644 → 0
View file @
c75c0662
---
title
:
Remove tempfile from external diff creation
merge_request
:
35750
author
:
type
:
performance
lib/carrier_wave_string_file.rb
View file @
b7b82dce
# frozen_string_literal: true
class
CarrierWaveStringFile
<
StringIO
attr_reader
:original_filename
def
initialize
(
data
,
original_filename
=
""
)
super
(
data
)
@original_filename
=
original_filename
def
original_filename
""
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment