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
3e2e6bfc
Commit
3e2e6bfc
authored
Sep 06, 2018
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Doesn't update default branch when HEAD doesn't change
parent
62c2e8bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
11 deletions
+36
-11
ee/app/services/geo/repository_sync_service.rb
ee/app/services/geo/repository_sync_service.rb
+1
-1
ee/spec/services/geo/repository_sync_service_spec.rb
ee/spec/services/geo/repository_sync_service_spec.rb
+35
-10
No files found.
ee/app/services/geo/repository_sync_service.rb
View file @
3e2e6bfc
...
...
@@ -48,7 +48,7 @@ module Geo
# Update the default branch querying the remote to determine its HEAD
def
update_root_ref
root_ref
=
repository
.
find_remote_root_ref
(
GEO_REMOTE_NAME
)
project
.
change_head
(
root_ref
)
if
root_ref
.
present?
project
.
change_head
(
root_ref
)
if
root_ref
.
present?
&&
root_ref
!=
project
.
default_branch
end
def
schedule_repack
...
...
ee/spec/services/geo/repository_sync_service_spec.rb
View file @
3e2e6bfc
...
...
@@ -215,21 +215,46 @@ describe Geo::RepositorySyncService do
context
'with non empty repositories'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
it
'syncs gitattributes to info/attributes'
do
expect
(
repository
).
to
receive
(
:copy_gitattributes
)
context
'when when HEAD change'
do
before
do
allow
(
project
.
repository
)
.
to
receive
(
:find_remote_root_ref
)
.
with
(
'geo'
)
.
and_return
(
'feature'
)
end
subject
.
execute
it
'syncs gitattributes to info/attributes'
do
expect
(
repository
).
to
receive
(
:copy_gitattributes
)
subject
.
execute
end
it
'updates the default branch'
do
expect
(
project
).
to
receive
(
:change_head
).
with
(
'feature'
).
once
subject
.
execute
end
end
it
'updates the default branch'
do
allow
(
project
.
repository
)
.
to
receive
(
:find_remote_root_ref
)
.
with
(
'geo'
)
.
and_return
(
'development'
)
context
'when HEAD does not change'
do
before
do
allow
(
project
.
repository
)
.
to
receive
(
:find_remote_root_ref
)
.
with
(
'geo'
)
.
and_return
(
project
.
default_branch
)
end
it
'does not sync gitattributes to info/attributes'
do
expect
(
repository
).
not_to
receive
(
:copy_gitattributes
)
subject
.
execute
end
expect
(
project
).
to
receive
(
:change_head
).
with
(
'development'
).
once
it
'does not update the default branch'
do
expect
(
project
).
not_to
receive
(
:change_head
)
subject
.
execute
subject
.
execute
end
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