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
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
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
16 additions
and
41 deletions
+16
-41
gemnasium_service.rb
app/models/project_services/gemnasium_service.rb
+1
-1
repository.rb
app/models/repository.rb
+0
-4
show.html.haml
app/views/admin/projects/show.html.haml
+7
-3
git_garbage_collect_worker.rb
app/workers/git_garbage_collect_worker.rb
+5
-4
repository_fork_worker.rb
app/workers/repository_fork_worker.rb
+1
-0
importer.rb
lib/gitlab/bare_repository_import/importer.rb
+1
-1
workhorse.rb
lib/gitlab/workhorse.rb
+0
-2
workhorse_spec.rb
spec/lib/gitlab/workhorse_spec.rb
+0
-3
repository_spec.rb
spec/models/repository_spec.rb
+0
-22
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
after:
data
[
:after
],
token:
token
,
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
app/models/repository.rb
View file @
c43e18fc
...
...
@@ -93,10 +93,6 @@ class Repository
"#<
#{
self
.
class
.
name
}
:
#{
@disk_path
}
>"
end
def
create_hooks
Gitlab
::
Git
::
Repository
.
create_hooks
(
path_to_repo
,
Gitlab
.
config
.
gitlab_shell
.
hooks_path
)
end
def
commit
(
ref
=
'HEAD'
)
return
nil
unless
exists?
return
ref
if
ref
.
is_a?
(
::
Commit
)
...
...
app/views/admin/projects/show.html.haml
View file @
c43e18fc
...
...
@@ -62,12 +62,16 @@
=
link_to
@project
.
ssh_url_to_repo
,
project_path
(
@project
)
-
if
@project
.
repository
.
exists?
%li
%span
.light
fs
:
%span
.light
Gitaly storage name
:
%strong
=
@project
.
repository
.
path_to_repo
=
@project
.
repository
.
storage
%li
%span
.light
Gitaly relative path:
%strong
=
@project
.
repository
.
relative_path
%li
%span
.light
Storage:
%span
.light
Storage
used
:
%strong
=
storage_counter
(
@project
.
statistics
.
storage_size
)
(
=
storage_counter
(
@project
.
statistics
.
repository_size
)
...
...
app/workers/git_garbage_collect_worker.rb
View file @
c43e18fc
...
...
@@ -28,16 +28,17 @@ class GitGarbageCollectWorker
task
=
task
.
to_sym
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
|
if
is_enabled
gitaly_call
(
task
,
project
.
repository
.
raw_repository
)
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
)
Gitlab
::
GitLogger
.
error
(
"
#{
description
}
failed:
\n
#{
output
}
"
)
unless
status
.
zero?
end
end
...
...
app/workers/repository_fork_worker.rb
View file @
c43e18fc
# Gitaly issue: https://gitlab.com/gitlab-org/gitaly/issues/1110
class
RepositoryForkWorker
include
ApplicationWorker
include
Gitlab
::
ShellAdapter
...
...
lib/gitlab/bare_repository_import/importer.rb
View file @
c43e18fc
...
...
@@ -63,7 +63,7 @@ module Gitlab
log
" * Created
#{
project
.
name
}
(
#{
project_full_path
}
)"
.
color
(
:green
)
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
)
else
...
...
lib/gitlab/workhorse.rb
View file @
c43e18fc
...
...
@@ -21,12 +21,10 @@ module Gitlab
raise
"Unsupported action:
#{
action
}
"
unless
ALLOWED_GIT_HTTP_ACTIONS
.
include?
(
action
.
to_s
)
project
=
repository
.
project
repo_path
=
repository
.
path_to_repo
params
=
{
GL_ID
:
Gitlab
::
GlId
.
gl_id
(
user
),
GL_REPOSITORY
:
Gitlab
::
GlRepository
.
gl_repository
(
project
,
is_wiki
),
GL_USERNAME
:
user
&
.
username
,
RepoPath
:
repo_path
,
ShowAllRefs
:
show_all_refs
}
server
=
{
...
...
spec/lib/gitlab/workhorse_spec.rb
View file @
c43e18fc
...
...
@@ -275,14 +275,12 @@ describe Gitlab::Workhorse do
describe
'.git_http_ok'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:repo_path
)
{
repository
.
path_to_repo
}
let
(
:action
)
{
'info_refs'
}
let
(
:params
)
do
{
GL_ID
:
"user-
#{
user
.
id
}
"
,
GL_USERNAME
:
user
.
username
,
GL_REPOSITORY
:
"project-
#{
project
.
id
}
"
,
RepoPath
:
repo_path
,
ShowAllRefs
:
false
}
end
...
...
@@ -297,7 +295,6 @@ describe Gitlab::Workhorse do
GL_ID
:
"user-
#{
user
.
id
}
"
,
GL_USERNAME
:
user
.
username
,
GL_REPOSITORY
:
"wiki-
#{
project
.
id
}
"
,
RepoPath
:
repo_path
,
ShowAllRefs
:
false
}
end
...
...
spec/models/repository_spec.rb
View file @
c43e18fc
...
...
@@ -501,28 +501,6 @@ describe Repository do
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
it
"commits a change that creates a new directory"
do
expect
do
...
...
spec/requests/git_http_spec.rb
View file @
c43e18fc
...
...
@@ -163,7 +163,7 @@ describe 'Git HTTP requests' do
download
(
path
)
do
|
response
|
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
...
...
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