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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
c43e18fc
Commit
c43e18fc
authored
Mar 28, 2018
by
Jacob Vosmaer (GitLab)
Committed by
Sean McGivern
Mar 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove some easy cases of 'path_to_repo' use
parent
066d2e0a
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
16 additions
and
41 deletions
+16
-41
app/models/project_services/gemnasium_service.rb
app/models/project_services/gemnasium_service.rb
+1
-1
app/models/repository.rb
app/models/repository.rb
+0
-4
app/views/admin/projects/show.html.haml
app/views/admin/projects/show.html.haml
+7
-3
app/workers/git_garbage_collect_worker.rb
app/workers/git_garbage_collect_worker.rb
+5
-4
app/workers/repository_fork_worker.rb
app/workers/repository_fork_worker.rb
+1
-0
lib/gitlab/bare_repository_import/importer.rb
lib/gitlab/bare_repository_import/importer.rb
+1
-1
lib/gitlab/workhorse.rb
lib/gitlab/workhorse.rb
+0
-2
spec/lib/gitlab/workhorse_spec.rb
spec/lib/gitlab/workhorse_spec.rb
+0
-3
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+0
-22
spec/requests/git_http_spec.rb
spec/requests/git_http_spec.rb
+1
-1
No files found.
app/models/project_services/gemnasium_service.rb
View file @
c43e18fc
...
@@ -36,7 +36,7 @@ class GemnasiumService < Service
...
@@ -36,7 +36,7 @@ class GemnasiumService < Service
after:
data
[
:after
],
after:
data
[
:after
],
token:
token
,
token:
token
,
api_key:
api_key
,
api_key:
api_key
,
repo:
project
.
repository
.
path_to_repo
repo:
project
.
repository
.
path_to_repo
# Gitaly: fixed by https://gitlab.com/gitlab-org/security-products/gemnasium-migration/issues/9
)
)
end
end
end
end
app/models/repository.rb
View file @
c43e18fc
...
@@ -93,10 +93,6 @@ class Repository
...
@@ -93,10 +93,6 @@ class Repository
"#<
#{
self
.
class
.
name
}
:
#{
@disk_path
}
>"
"#<
#{
self
.
class
.
name
}
:
#{
@disk_path
}
>"
end
end
def
create_hooks
Gitlab
::
Git
::
Repository
.
create_hooks
(
path_to_repo
,
Gitlab
.
config
.
gitlab_shell
.
hooks_path
)
end
def
commit
(
ref
=
'HEAD'
)
def
commit
(
ref
=
'HEAD'
)
return
nil
unless
exists?
return
nil
unless
exists?
return
ref
if
ref
.
is_a?
(
::
Commit
)
return
ref
if
ref
.
is_a?
(
::
Commit
)
...
...
app/views/admin/projects/show.html.haml
View file @
c43e18fc
...
@@ -62,12 +62,16 @@
...
@@ -62,12 +62,16 @@
=
link_to
@project
.
ssh_url_to_repo
,
project_path
(
@project
)
=
link_to
@project
.
ssh_url_to_repo
,
project_path
(
@project
)
-
if
@project
.
repository
.
exists?
-
if
@project
.
repository
.
exists?
%li
%li
%span
.light
fs
:
%span
.light
Gitaly storage name
:
%strong
%strong
=
@project
.
repository
.
path_to_repo
=
@project
.
repository
.
storage
%li
%span
.light
Gitaly relative path:
%strong
=
@project
.
repository
.
relative_path
%li
%li
%span
.light
Storage:
%span
.light
Storage
used
:
%strong
=
storage_counter
(
@project
.
statistics
.
storage_size
)
%strong
=
storage_counter
(
@project
.
statistics
.
storage_size
)
(
(
=
storage_counter
(
@project
.
statistics
.
repository_size
)
=
storage_counter
(
@project
.
statistics
.
repository_size
)
...
...
app/workers/git_garbage_collect_worker.rb
View file @
c43e18fc
...
@@ -28,16 +28,17 @@ class GitGarbageCollectWorker
...
@@ -28,16 +28,17 @@ class GitGarbageCollectWorker
task
=
task
.
to_sym
task
=
task
.
to_sym
cmd
=
command
(
task
)
cmd
=
command
(
task
)
repo_path
=
project
.
repository
.
path_to_repo
description
=
"'
#{
cmd
.
join
(
' '
)
}
' in
#{
repo_path
}
"
Gitlab
::
GitLogger
.
info
(
description
)
gitaly_migrate
(
GITALY_MIGRATED_TASKS
[
task
])
do
|
is_enabled
|
gitaly_migrate
(
GITALY_MIGRATED_TASKS
[
task
])
do
|
is_enabled
|
if
is_enabled
if
is_enabled
gitaly_call
(
task
,
project
.
repository
.
raw_repository
)
gitaly_call
(
task
,
project
.
repository
.
raw_repository
)
else
else
repo_path
=
project
.
repository
.
path_to_repo
description
=
"'
#{
cmd
.
join
(
' '
)
}
' in
#{
repo_path
}
"
Gitlab
::
GitLogger
.
info
(
description
)
output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
,
repo_path
)
output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
,
repo_path
)
Gitlab
::
GitLogger
.
error
(
"
#{
description
}
failed:
\n
#{
output
}
"
)
unless
status
.
zero?
Gitlab
::
GitLogger
.
error
(
"
#{
description
}
failed:
\n
#{
output
}
"
)
unless
status
.
zero?
end
end
end
end
...
...
app/workers/repository_fork_worker.rb
View file @
c43e18fc
# Gitaly issue: https://gitlab.com/gitlab-org/gitaly/issues/1110
class
RepositoryForkWorker
class
RepositoryForkWorker
include
ApplicationWorker
include
ApplicationWorker
include
Gitlab
::
ShellAdapter
include
Gitlab
::
ShellAdapter
...
...
lib/gitlab/bare_repository_import/importer.rb
View file @
c43e18fc
...
@@ -63,7 +63,7 @@ module Gitlab
...
@@ -63,7 +63,7 @@ module Gitlab
log
" * Created
#{
project
.
name
}
(
#{
project_full_path
}
)"
.
color
(
:green
)
log
" * Created
#{
project
.
name
}
(
#{
project_full_path
}
)"
.
color
(
:green
)
project
.
write_repository_config
project
.
write_repository_config
project
.
repository
.
create_hooks
Gitlab
::
Git
::
Repository
.
create_hooks
(
project
.
repository
.
path_to_repo
,
Gitlab
.
config
.
gitlab_shell
.
hooks_path
)
ProjectCacheWorker
.
perform_async
(
project
.
id
)
ProjectCacheWorker
.
perform_async
(
project
.
id
)
else
else
...
...
lib/gitlab/workhorse.rb
View file @
c43e18fc
...
@@ -21,12 +21,10 @@ module Gitlab
...
@@ -21,12 +21,10 @@ module Gitlab
raise
"Unsupported action:
#{
action
}
"
unless
ALLOWED_GIT_HTTP_ACTIONS
.
include?
(
action
.
to_s
)
raise
"Unsupported action:
#{
action
}
"
unless
ALLOWED_GIT_HTTP_ACTIONS
.
include?
(
action
.
to_s
)
project
=
repository
.
project
project
=
repository
.
project
repo_path
=
repository
.
path_to_repo
params
=
{
params
=
{
GL_ID
:
Gitlab
::
GlId
.
gl_id
(
user
),
GL_ID
:
Gitlab
::
GlId
.
gl_id
(
user
),
GL_REPOSITORY
:
Gitlab
::
GlRepository
.
gl_repository
(
project
,
is_wiki
),
GL_REPOSITORY
:
Gitlab
::
GlRepository
.
gl_repository
(
project
,
is_wiki
),
GL_USERNAME
:
user
&
.
username
,
GL_USERNAME
:
user
&
.
username
,
RepoPath
:
repo_path
,
ShowAllRefs
:
show_all_refs
ShowAllRefs
:
show_all_refs
}
}
server
=
{
server
=
{
...
...
spec/lib/gitlab/workhorse_spec.rb
View file @
c43e18fc
...
@@ -275,14 +275,12 @@ describe Gitlab::Workhorse do
...
@@ -275,14 +275,12 @@ describe Gitlab::Workhorse do
describe
'.git_http_ok'
do
describe
'.git_http_ok'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:repo_path
)
{
repository
.
path_to_repo
}
let
(
:action
)
{
'info_refs'
}
let
(
:action
)
{
'info_refs'
}
let
(
:params
)
do
let
(
:params
)
do
{
{
GL_ID
:
"user-
#{
user
.
id
}
"
,
GL_ID
:
"user-
#{
user
.
id
}
"
,
GL_USERNAME
:
user
.
username
,
GL_USERNAME
:
user
.
username
,
GL_REPOSITORY
:
"project-
#{
project
.
id
}
"
,
GL_REPOSITORY
:
"project-
#{
project
.
id
}
"
,
RepoPath
:
repo_path
,
ShowAllRefs
:
false
ShowAllRefs
:
false
}
}
end
end
...
@@ -297,7 +295,6 @@ describe Gitlab::Workhorse do
...
@@ -297,7 +295,6 @@ describe Gitlab::Workhorse do
GL_ID
:
"user-
#{
user
.
id
}
"
,
GL_ID
:
"user-
#{
user
.
id
}
"
,
GL_USERNAME
:
user
.
username
,
GL_USERNAME
:
user
.
username
,
GL_REPOSITORY
:
"wiki-
#{
project
.
id
}
"
,
GL_REPOSITORY
:
"wiki-
#{
project
.
id
}
"
,
RepoPath
:
repo_path
,
ShowAllRefs
:
false
ShowAllRefs
:
false
}
}
end
end
...
...
spec/models/repository_spec.rb
View file @
c43e18fc
...
@@ -501,28 +501,6 @@ describe Repository do
...
@@ -501,28 +501,6 @@ describe Repository do
end
end
end
end
describe
'#create_hooks'
do
let
(
:hook_path
)
{
File
.
join
(
repository
.
path_to_repo
,
'hooks'
)
}
it
'symlinks the global hooks directory'
do
repository
.
create_hooks
expect
(
File
.
symlink?
(
hook_path
)).
to
be
true
expect
(
File
.
readlink
(
hook_path
)).
to
eq
(
Gitlab
.
config
.
gitlab_shell
.
hooks_path
)
end
it
'replaces existing symlink with the right directory'
do
FileUtils
.
mkdir_p
(
hook_path
)
expect
(
File
.
symlink?
(
hook_path
)).
to
be
false
repository
.
create_hooks
expect
(
File
.
symlink?
(
hook_path
)).
to
be
true
expect
(
File
.
readlink
(
hook_path
)).
to
eq
(
Gitlab
.
config
.
gitlab_shell
.
hooks_path
)
end
end
describe
"#create_dir"
do
describe
"#create_dir"
do
it
"commits a change that creates a new directory"
do
it
"commits a change that creates a new directory"
do
expect
do
expect
do
...
...
spec/requests/git_http_spec.rb
View file @
c43e18fc
...
@@ -163,7 +163,7 @@ describe 'Git HTTP requests' do
...
@@ -163,7 +163,7 @@ describe 'Git HTTP requests' do
download
(
path
)
do
|
response
|
download
(
path
)
do
|
response
|
json_body
=
ActiveSupport
::
JSON
.
decode
(
response
.
body
)
json_body
=
ActiveSupport
::
JSON
.
decode
(
response
.
body
)
expect
(
json_body
[
'Repo
Path'
]).
to
include
(
wiki
.
repository
.
disk
_path
)
expect
(
json_body
[
'Repo
sitory'
][
'relative_path'
]).
to
eq
(
wiki
.
repository
.
relative
_path
)
end
end
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