BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
ce03eba5
Commit
ce03eba5
authored
Nov 07, 2016
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '23034-speed-up-testenv-set-repo-refs' into 'master'
Use `git update-ref --stdin -z` to speed up TestEnv.set_repo_refs See merge request !7283
parents
76ff9fff
29668aec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
13 deletions
+11
-13
test_env.rb
spec/support/test_env.rb
+11
-13
No files found.
spec/support/test_env.rb
View file @
ce03eba5
...
...
@@ -204,20 +204,18 @@ module TestEnv
end
def
set_repo_refs
(
repo_path
,
branch_sha
)
instructions
=
branch_sha
.
map
{
|
branch
,
sha
|
"update refs/heads/
#{
branch
}
\x00
#{
sha
}
\x00
"
}.
join
(
"
\x00
"
)
<<
"
\x00
"
update_refs
=
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
update-ref --stdin -z)
reset
=
proc
do
IO
.
popen
(
update_refs
,
"w"
)
{
|
io
|
io
.
write
(
instructions
)
}
$?
.
success?
end
Dir
.
chdir
(
repo_path
)
do
branch_sha
.
each
do
|
branch
,
sha
|
# Try to reset without fetching to avoid using the network.
reset
=
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
update-ref refs/heads/
#{
branch
}
#{
sha
}
)
unless
system
(
*
reset
)
if
system
(
*
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
fetch origin)
)
unless
system
(
*
reset
)
raise
'The fetched test seed '
\
'does not contain the required revision.'
end
else
raise
'Could not fetch test seed repository.'
end
end
# Try to reset without fetching to avoid using the network.
unless
reset
.
call
raise
'Could not fetch test seed repository.'
unless
system
(
*
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
fetch origin)
)
raise
'The fetched test seed does not contain the required revision.'
unless
reset
.
call
end
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