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
4f4dcd3c
Commit
4f4dcd3c
authored
Oct 02, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add latest changes from gitlab-org/gitlab@master
parent
2cf5eb14
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
93 additions
and
8 deletions
+93
-8
CHANGELOG.md
CHANGELOG.md
+0
-4
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+12
-0
lib/gitlab/gitaly_client.rb
lib/gitlab/gitaly_client.rb
+1
-1
lib/gitlab/gitaly_client/repository_service.rb
lib/gitlab/gitaly_client/repository_service.rb
+12
-0
lib/gitlab/shell.rb
lib/gitlab/shell.rb
+13
-3
spec/lib/gitlab/git/repository_spec.rb
spec/lib/gitlab/git/repository_spec.rb
+29
-0
spec/lib/gitlab/gitaly_client/repository_service_spec.rb
spec/lib/gitlab/gitaly_client/repository_service_spec.rb
+22
-0
spec/spec_helper.rb
spec/spec_helper.rb
+4
-0
No files found.
CHANGELOG.md
View file @
4f4dcd3c
...
@@ -2,10 +2,6 @@
...
@@ -2,10 +2,6 @@
documentation
](
doc/development/changelog.md
)
for instructions on adding your own
documentation
](
doc/development/changelog.md
)
for instructions on adding your own
entry.
entry.
## 12.3.4
-
No changes.
## 12.3.2
## 12.3.2
### Security (12 changes)
### Security (12 changes)
...
...
lib/gitlab/git/repository.rb
View file @
4f4dcd3c
...
@@ -131,6 +131,18 @@ module Gitlab
...
@@ -131,6 +131,18 @@ module Gitlab
end
end
end
end
def
rename
(
new_relative_path
)
wrapped_gitaly_errors
do
gitaly_repository_client
.
rename
(
new_relative_path
)
end
end
def
remove
wrapped_gitaly_errors
do
gitaly_repository_client
.
remove
end
end
def
expire_has_local_branches_cache
def
expire_has_local_branches_cache
clear_memoization
(
:has_local_branches
)
clear_memoization
(
:has_local_branches
)
end
end
...
...
lib/gitlab/gitaly_client.rb
View file @
4f4dcd3c
...
@@ -365,7 +365,7 @@ module Gitlab
...
@@ -365,7 +365,7 @@ module Gitlab
if
Sidekiq
.
server?
if
Sidekiq
.
server?
6
.
hours
6
.
hours
else
else
55
.
seconds
default_timeout
end
end
end
end
...
...
lib/gitlab/gitaly_client/repository_service.rb
View file @
4f4dcd3c
...
@@ -347,6 +347,18 @@ module Gitlab
...
@@ -347,6 +347,18 @@ module Gitlab
GitalyClient
.
call
(
@storage
,
:object_pool_service
,
:disconnect_git_alternates
,
request
,
timeout:
GitalyClient
.
long_timeout
)
GitalyClient
.
call
(
@storage
,
:object_pool_service
,
:disconnect_git_alternates
,
request
,
timeout:
GitalyClient
.
long_timeout
)
end
end
def
rename
(
relative_path
)
request
=
Gitaly
::
RenameRepositoryRequest
.
new
(
repository:
@gitaly_repo
,
relative_path:
relative_path
)
GitalyClient
.
call
(
@storage
,
:repository_service
,
:rename_repository
,
request
,
timeout:
GitalyClient
.
fast_timeout
)
end
def
remove
request
=
Gitaly
::
RemoveRepositoryRequest
.
new
(
repository:
@gitaly_repo
)
GitalyClient
.
call
(
@storage
,
:repository_service
,
:remove_repository
,
request
,
timeout:
GitalyClient
.
long_timeout
)
end
private
private
def
search_results_from_response
(
gitaly_response
)
def
search_results_from_response
(
gitaly_response
)
...
...
lib/gitlab/shell.rb
View file @
4f4dcd3c
...
@@ -126,7 +126,13 @@ module Gitlab
...
@@ -126,7 +126,13 @@ module Gitlab
def
mv_repository
(
storage
,
path
,
new_path
)
def
mv_repository
(
storage
,
path
,
new_path
)
return
false
if
path
.
empty?
||
new_path
.
empty?
return
false
if
path
.
empty?
||
new_path
.
empty?
!!
mv_directory
(
storage
,
"
#{
path
}
.git"
,
"
#{
new_path
}
.git"
)
Gitlab
::
Git
::
Repository
.
new
(
storage
,
"
#{
path
}
.git"
,
nil
,
nil
).
rename
(
"
#{
new_path
}
.git"
)
true
rescue
=>
e
Gitlab
::
Sentry
.
track_acceptable_exception
(
e
,
extra:
{
path:
path
,
new_path:
new_path
,
storage:
storage
})
false
end
end
# Fork repository to new path
# Fork repository to new path
...
@@ -151,9 +157,13 @@ module Gitlab
...
@@ -151,9 +157,13 @@ module Gitlab
def
remove_repository
(
storage
,
name
)
def
remove_repository
(
storage
,
name
)
return
false
if
name
.
empty?
return
false
if
name
.
empty?
!!
rm_directory
(
storage
,
"
#{
name
}
.git"
)
Gitlab
::
Git
::
Repository
.
new
(
storage
,
"
#{
name
}
.git"
,
nil
,
nil
).
remove
rescue
ArgumentError
=>
e
true
rescue
=>
e
Rails
.
logger
.
warn
(
"Repository does not exist:
#{
e
}
at:
#{
name
}
.git"
)
# rubocop:disable Gitlab/RailsLogger
Rails
.
logger
.
warn
(
"Repository does not exist:
#{
e
}
at:
#{
name
}
.git"
)
# rubocop:disable Gitlab/RailsLogger
Gitlab
::
Sentry
.
track_acceptable_exception
(
e
,
extra:
{
path:
name
,
storage:
storage
})
false
false
end
end
...
...
spec/lib/gitlab/git/repository_spec.rb
View file @
4f4dcd3c
...
@@ -2236,4 +2236,33 @@ describe Gitlab::Git::Repository, :seed_helper do
...
@@ -2236,4 +2236,33 @@ describe Gitlab::Git::Repository, :seed_helper do
expect
(
repository
.
commit
(
new_commit
.
oid
).
id
).
to
eq
(
new_commit
.
oid
)
expect
(
repository
.
commit
(
new_commit
.
oid
).
id
).
to
eq
(
new_commit
.
oid
)
end
end
end
end
describe
'#rename'
do
let
(
:project
)
{
create
(
:project
,
:repository
)}
let
(
:repository
)
{
project
.
repository
}
it
'moves the repository'
do
checksum
=
repository
.
checksum
new_relative_path
=
"rename_test/relative/path"
renamed_repository
=
Gitlab
::
Git
::
Repository
.
new
(
repository
.
storage
,
new_relative_path
,
nil
,
nil
)
repository
.
rename
(
new_relative_path
)
expect
(
renamed_repository
.
checksum
).
to
eq
(
checksum
)
expect
(
repository
.
exists?
).
to
be
false
end
end
describe
'#remove'
do
let
(
:project
)
{
create
(
:project
,
:repository
)}
let
(
:repository
)
{
project
.
repository
}
it
'removes the repository'
do
expect
(
repository
.
exists?
).
to
be
true
repository
.
remove
expect
(
repository
.
raw_repository
.
exists?
).
to
be
false
end
end
end
end
spec/lib/gitlab/gitaly_client/repository_service_spec.rb
View file @
4f4dcd3c
...
@@ -272,4 +272,26 @@ describe Gitlab::GitalyClient::RepositoryService do
...
@@ -272,4 +272,26 @@ describe Gitlab::GitalyClient::RepositoryService do
end
end
end
end
end
end
describe
'remove'
do
it
'sends a remove_repository message'
do
expect_any_instance_of
(
Gitaly
::
RepositoryService
::
Stub
)
.
to
receive
(
:remove_repository
)
.
with
(
gitaly_request_with_path
(
storage_name
,
relative_path
),
kind_of
(
Hash
))
.
and_return
(
double
(
value:
true
))
client
.
remove
end
end
describe
'rename'
do
it
'sends a rename_repository message'
do
expect_any_instance_of
(
Gitaly
::
RepositoryService
::
Stub
)
.
to
receive
(
:rename_repository
)
.
with
(
gitaly_request_with_path
(
storage_name
,
relative_path
),
kind_of
(
Hash
))
.
and_return
(
double
(
value:
true
))
client
.
rename
(
'some/new/path'
)
end
end
end
end
spec/spec_helper.rb
View file @
4f4dcd3c
...
@@ -350,6 +350,10 @@ FactoryBot::SyntaxRunner.class_eval do
...
@@ -350,6 +350,10 @@ FactoryBot::SyntaxRunner.class_eval do
include
RSpec
::
Mocks
::
ExampleMethods
include
RSpec
::
Mocks
::
ExampleMethods
end
end
# Use FactoryBot 4.x behavior:
# https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#associations
FactoryBot
.
use_parent_strategy
=
false
ActiveRecord
::
Migration
.
maintain_test_schema!
ActiveRecord
::
Migration
.
maintain_test_schema!
Shoulda
::
Matchers
.
configure
do
|
config
|
Shoulda
::
Matchers
.
configure
do
|
config
|
...
...
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