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
00b44044
Commit
00b44044
authored
Aug 21, 2017
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
skip the branch fetch if we already have the sha
parent
c13f712c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
+16
-12
app/models/repository.rb
app/models/repository.rb
+16
-12
No files found.
app/models/repository.rb
View file @
00b44044
...
...
@@ -991,23 +991,27 @@ class Repository
end
def
with_repo_branch_commit
(
start_repository
,
start_branch_name
)
return
yield
(
nil
)
if
start_repository
.
empty_repo?
tmp_ref
=
nil
return
yield
nil
if
start_repository
.
empty_repo?
branch_
name_or_sha
=
branch_
commit
=
if
start_repository
==
self
start_branch_name
commit
(
start_branch_name
)
else
tmp_ref
=
fetch_ref
(
start_repository
.
path_to_repo
,
"
#{
Gitlab
::
Git
::
BRANCH_REF_PREFIX
}#{
start_branch_name
}
"
,
"refs/tmp/
#{
SecureRandom
.
hex
}
/head"
)
start_repository
.
commit
(
start_branch_name
).
sha
sha
=
start_repository
.
find_branch
(
start_branch_name
).
target
commit
(
sha
)
||
begin
tmp_ref
=
fetch_ref
(
start_repository
.
path_to_repo
,
"
#{
Gitlab
::
Git
::
BRANCH_REF_PREFIX
}#{
start_branch_name
}
"
,
"refs/tmp/
#{
SecureRandom
.
hex
}
/head"
)
commit
(
start_repository
.
commit
(
start_branch_name
).
sha
)
end
end
yield
(
commit
(
branch_name_or_sha
))
yield
branch_commit
ensure
rugged
.
references
.
delete
(
tmp_ref
)
if
tmp_ref
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